Forum Moderators: open

Message Too Old, No Replies

MySQL and AES ENCRYPT()

Is my method safe?

         

Kaerigan

12:12 pm on Apr 9, 2007 (gmt 0)

10+ Year Member



Hello,

I'm working in a project where the owner wants to encrypt all passwords in the (MySQL) database. This may sound stupid, but is it safe to use the users' own passwords as keys for their encryptions? Example, if I would encrypt all passwords in one go:

UPDATE users SET password = AES_ENCRYPT(password, password);

Is there some giant security hole I am not aware of in this use of AES?

Thankful for answers.

eelixduppy

1:23 pm on Apr 9, 2007 (gmt 0)



Using their own passwords as a key sounds like a good idea, but I don't think it will provide any additional security; no more, than say, just encrypting it with a static key. (then again, I do not know for sure)

Many developers store passwords in a database using a one-way encryption that cannot be "decrypted", such as a MD5 hash. Then to you would only compare the two passwords after encryption, and never actually plain text.

Kaerigan

4:12 pm on Apr 10, 2007 (gmt 0)

10+ Year Member



Well, I've read that MD5 is not actually that safe after all, that people have been able to get the same result from two different strings and such. But hey, I'm not going to store government secrets, so MD5's probably enough for me?

stajer

7:35 pm on Apr 10, 2007 (gmt 0)

10+ Year Member



How would you decrypt the password - you wouldn't know the key until you decrypted the password, which you can't decrypt without the key.

The biggest security hole I see is having your key in your code. Look for a 3rd party encryption system that uses a shell script to write the key directly to your server bios/rom.