I am developing a web application in which I need to encrypt sensitive information. My plan is to use AES-256, where the private key is encrypted with the user's password hash. I need to save a password hash for authentication purposes, but obviously it cannot be used to encrypt the private key. My current thought is to use bcrypt to generate the key, which will be used to encrypt the private key. For authentication, my thought was to simply hash the password using bcrypt, and then the hash that the hash uses bcrypt again, and then store that hash in the database. Since this is one way, don't you need to use a stored hash to decrypt the private key? Are there any obvious security issues when doing this that I can skip?
My other thought was to use two different encryption algorithms, such as using the bcrypt hash to encrypt the private key and storing the SHA-2 hash for authentication purposes.
Thank you for your help.
user1576169
source share