Z
Zsolt Koppany
Hi,
how can I crypt a password that can be de-crypted only if a key is known?
Zsolt
how can I crypt a password that can be de-crypted only if a key is known?
Zsolt
Zsolt Koppany said:how can I crypt a password that can be de-crypted only if a key is known?
Zsolt Koppany said:how can I crypt a password that can be de-crypted only if a key is known?
how can I crypt a password that can be de-crypted only if a key is known?
Generally you never decrypt passwords: You store the encrypted/hashed
version, then use the same algorith on a clear-text password provided,
and compare the two.
Zsolt Koppany said:I do have to decrypt passwords because I have to start programs (for
example subversion) that need passwords.
Zsolt Koppany said:I unstand that it is a security risk but some process are runnning every
night and nobody can provide a password.
Oliver said:Okay, if you have no user available to provide the password then
SOMEWHERE, you have to store a password in plaintext, right? Either the
password for the process, or the password to unlock the password for the
process, or the password to unlock the password to unlock the password for
the process, and so on.
So basically encrypting passwords for this purpose is just a big joke.
If the passwords don't change often, the best I can think of is to hardcode
the passwords directly into the program, so that at the very least, an
attacker would need to decompile the program to get the passwords.
Alternatively, encrypt the passwords in a file, and then decrypt them
using a password hardcoded in the program.
Or encrypt the passwords in a file, and encrypt the password for THAT
file in a file, and then hardcode the password in your program.
And so on.
There should be a better way of what you want to do though, so if you'd
actually explain what it is you're trying to do (e.g. what processes you're
running, what environment you're working in, etc.), you might get more
advice. But I think this is no longer a Java issue.
Raymond DeCampo said:Wouldn't the most sensible approach be to encrypt the password in a file
(or other configuration artifact) with a public key and decrypt it with
the private key?
I don't think the environment really comes into play. The problem of an
automated process needing to access a password-protected resource is both
generic enough to be common and specific enough to describe the needs of
the OP.
Oliver said:You'd still need to store the private key somewhere; either in an
external file, or hardcoded in the Java program itself, so you basically end
up in the same situation.
Needing to supply a password, but not having a user around to supply the
password is a bad situation to be in, IMHO. Depending on what
password-protected resources the OP is trying to access, I'd recommend he
change his environment so that an administrator (or some other trusted
invididual) can install the program, and have the program inherit his rights
(operating system permitting), and then have the resource check for whether
the requestee has rights, rather than checking for an explicit password
(again, OS permitting, and resources permitting).
For example, if the user's running Linux, and the resources are files,
this is certainly possible. Under Windows, AFAIK, it's not, because you
cannot run program under another user's privilege without explicitly
providing a password WHEN the program gets executed. In this latter
environment, you'd probably need to have the program running continuously in
the background, so that it always maintains its original permission
settings.
Zsolt Koppany said:We just start subversion and cvs clients to checkout sources from remote
servers because we have to provide statistical data (number of files etc).
Please understand that I DO NEED the passwords. It would be great if that
was not the case but it is, and I cannot do anything about that.
I like for example UNIX crypt that crypts a file with a key. Do you know
such a java solution?
Zsolt Koppany said:We just start subversion and cvs clients to checkout sources
from remote servers because we have to provide statistical data
(number of files etc). Please understand that I DO NEED the
passwords. It would be great if that was not the case but it
is, and I cannot do anything about that.
Joan said:One place I worked some time ago had a nicely typed list of all user
account
names and passwords scotch taped to the side of the line printer. Or ask
your boss for a list. After all, you can't polish her shoes if she doesn't
have any.
Oliver said:If my understanding of Zsolt's problem is correct, there will be no
users around to enter in the password, so having the password written down
on a piece of paper isn't going to be much help. (S)he wants to write a Java
program to programmatically enter in the password.
Zsolt said:We just start subversion and cvs clients to checkout sources from remote
servers because we have to provide statistical data (number of files etc).
Please understand that I DO NEED the passwords. It would be great if that
was not the case but it is, and I cannot do anything about that.
I like for example UNIX crypt that crypts a file with a key. Do you know
such a java solution?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.