I am looking for an encryption algorithm that would allow me to know if the password supplied is the correct one or not.
This question can be considered as a follow-up for Q. In particular the answer from bethlakshmi:
When you want the server to use the key, I'm guessing the process is this:
- user gives the system his password
- system checks the password, hashing it - and it's good.
- system takes the password (not the hash!) and the salt and computes the encryption key
- system takes encryption key and decrypts AES Key
I would like to do the steps 3 and 4 and forget about the 1 and 2. So, I don't want to store the hash of the password (or password+salt), so I don't want to check the password for correctness as in steps 1 and 2.
Proposal: I would like to compute the encryption key and try to decrypt the AES Key. One way would be that the AES key once decrypted with a valid password then can really allow authentication or... and in case invalid would make the authentication fail.
- First question: Is the proposal considered bad practice or not? in case yes bad practice, of course please add the why?
- Back to the real question: Is there an encryption method (by this I mean the encryption method used to encrypt the AES key) that would return some error code if the password supplied is incorrect?