crypto-pouch
crypto-pouch copied to clipboard
enhancement: support changing password
Currently you take the user password, pass it through pbkdf2, then use the result as the encryption key. If you were to instead use the result to encrypt/decrypt a buffer containing the key, then you could change the password trivially.
hm not a bad idea
On Sat, Dec 3, 2016 at 11:03 AM arolson101 [email protected] wrote:
Currently you take the user password, pass it through pbkdf2, then use the result as the encryption key. If you were to instead use the result to encrypt/decrypt a buffer containing the key, then you could change the password trivially.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/calvinmetcalf/crypto-pouch/issues/42, or mute the thread https://github.com/notifications/unsubscribe-auth/ABE4n-5WRl1uqQcWu3e7eW3h9z3SDuj2ks5rEZK3gaJpZM4LDVdO .
you could also use this to easily validate whether the password is correct
you get an error about being unable to decrypt when that happens now, because you never actually know if it's because somebody modified the db or your password is wrong
Hey, just checking in here. Changing passwords is an inevitable part of working with passwords, so I'm certainly interested in implementing this in crypto-pouch. Could y'all explain it to me again?
Create a random db encryption key (dbkey). User provides key (ukey). Use ukey to encrypt dbkey (edbkey), store it separately from the db itself.
When opening db, get ukey from user, get edbkey from store, use ukey to decrypt edbkey to get dbkey and use it for db. If the decryption fails it’s because you have the wrong key- no cryptic message.
To rekey the db, just get a new ukey, re-encrypt dbkey with it and overwrite the stored edbkey.