data key is not encrypted with aes-cbc as well

This commit is contained in:
azivner
2017-11-15 23:39:50 -05:00
parent 5313ac47e6
commit c190c738a2
13 changed files with 109 additions and 33 deletions

View File

@@ -18,12 +18,10 @@ async function changePassword(currentPassword, newPassword, req) {
const newPasswordVerificationKey = utils.toBase64(await my_scrypt.getVerificationHash(newPassword));
const newPasswordDerivedKey = await my_scrypt.getPasswordDerivedKey(newPassword);
const decryptedDataKey = await password_encryption.getDecryptedDataKey(currentPassword);
const newEncryptedDataKey = password_encryption.encryptDataKey(newPasswordDerivedKey, decryptedDataKey);
const decryptedDataKey = await password_encryption.getDecryptedDataKeyCbc(currentPassword);
await sql.doInTransaction(async () => {
await options.setOption('encrypted_data_key', newEncryptedDataKey);
await password_encryption.setDataKey(newPasswordDerivedKey, decryptedDataKey);
await options.setOption('password_verification_hash', newPasswordVerificationKey);