Search code examples
securityencryptionpasswordsreset-password

How to add a forgot password feature for the described system without compromising its security?


I created a security system that uses the users password to encrypt the users private key which is then stored on the database. So a user can only retrieve the private key if he enters the correct password which is then used to decrypt the private key stored on the database.

This system has some admirable security features but has the flaw that it is hard to do a 'forgotten password' option. The only way I could imagine is by storing a copy of all private keys somewhere else and encrypt them with a master server password and when a user forgets his password the server allows him to re encrypt his private key with the new password.

The problem with this method is that if the master server password where somehow compromised all account information would also be compromised with it. Is there a way of adding a reset password method without having to change the system to much or compromising its security?


Solution

  • If you escrow the private keys you need to have them on another server that is not directly connected to the Internet. Then rate limit and alarm all accesses to the escrowed keys. Also consider an HSM.