I am doing a password manager in Java. But now I am VERY confused because of the encryption. There will be the program login, where the user types its password, and it compares to a SHA512 hash. If it matches, the user logs in, if it doesn’t, then the user doesn’t login. I think there is no problem at this point.
And then, I am using AES to encrypt the user saved passwords. The user logs in, and then clicks on an "decrypt" button to decrypt his saved passwords.
My problem is, how am i going to do this? Because I thought for a bit, and... the decryption key must be saved somewhere. But it cant be in plain text... PLUS it needs to be exactly 16 chars long.
I created a thread on Reddit - http://www.reddit.com/r/java/comments/2awvjt/storing_encryption_key/
They give me several options, but none seems to be what I want. Why? Let's see 3 options a user gave me:
Store the encryption key. Not secure in the least
User has a password that is used to encrypt the encryption key - Pretty secure and usable
User has a private encryption key that you don't store. Very secure, very usable.
Well these are my opinions:
Obviously I’m not going to use that one, since the key will be stored in plaintext.
Well, I can hash the encryption key! But the hash must be stored somewhere! And its the hashed encryption key that’s going to be used to decrypt the user passwords... so I can use 16 chars of it. It is not user friendly if the user needs to set and remember a 16 char password! So i guess this is NOT secure
If I don’t store it, how am I going to decrypt it?
So, what can you suggest me?