Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement: support changing password #42

Open
arolson101 opened this issue Dec 3, 2016 · 5 comments
Open

enhancement: support changing password #42

arolson101 opened this issue Dec 3, 2016 · 5 comments

Comments

@arolson101
Copy link

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.

@calvinmetcalf
Copy link
Owner

calvinmetcalf commented Dec 4, 2016 via email

@arolson101
Copy link
Author

you could also use this to easily validate whether the password is correct

@calvinmetcalf
Copy link
Owner

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

@garbados
Copy link
Collaborator

garbados commented Aug 6, 2021

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?

@arolson101
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants