in reply to Re: Password Encryption
in thread Password Encryption
Good call on knowing what reqs you have and tieing that to what type of security you need; however, I need to nitpick on a few things:
if I understand your requirements correctly, you need to be able to retrieve the password but you don't want to store it in plaintext. One-way hashing algorithms such as the crypt function or the MD5 module won't help there (my favourite quote to illustrate this point is "you can wind a sausage machine backwards but it won't give you pigs" - if only I could remember who said it).
True but that's okay because you never need to compare the plaintext, you compare the output of the one-way hash with the stored value.
Actually, nothing is going to be really secure since if someone can read your script they will have all the info they need to decrypt the password.
Well ... nothing in and of itself is secure. You need several layers of security. When I first read the problem, I didn't think the passwords would be stored in a script or going across the wire (in plaintext). If you need to store the password in a script, well that's where things like ACLs and file permissions come into play. As for going across the wire, then you encrypt the wire via https (web) or SSL -- security is all about layers.
update: And as a bonus, if you use one-way hash, there is nothing in the script that "decrypts" the password. The script would run the user supplied password through the one-way hash and compare the output to the stored value.
If you just want to slow someone down, encode it using MIME::Base64 like this:
Hmmm ... well there's a lot of controversy about security through obscurity and with base64 - that's what you're doing. I think it would fail even quicker than crypt and would be useless all together once someone knew base64 was the algorithm. With one-way hash functions, you can know the algorithm (des, md5) but you never really know that you have cracked the password until you try to use it. With base64, once you know base64 is the obfuscation, you don't have to try to use the password - you know it's the plaintext.
-derby
|
|---|