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

@@ -1,7 +1,6 @@
const sql = require('../services/sql');
const data_encryption = require('../services/data_encryption');
const password_encryption = require('../services/password_encryption');
const my_scrypt = require('../services/my_scrypt');
const readline = require('readline');
const cl = readline.createInterface(process.stdin, process.stdout);
@@ -46,11 +45,4 @@ module.exports = async () => {
await sql.execute("UPDATE notes SET note_title = ?, note_text = ? WHERE note_id = ?", [noteHistory.note_title, noteHistory.note_text, noteHistory.note_history_id]);
}
const passwordDerivedKey = await my_scrypt.getPasswordDerivedKey(password);
// trimming to 128bits (for AES-128)
const trimmedDataKey = dataKey.slice(0, 16);
await password_encryption.encryptDataKey(passwordDerivedKey, trimmedDataKey);
};