concat ciphertexts in browser.js for encryption/decryption
This commit is contained in:
parent
4fc0853915
commit
bc7ced6b7b
10
browser.js
10
browser.js
|
@ -78,13 +78,15 @@ function getAes(op) {
|
||||||
} else {
|
} else {
|
||||||
if (op === 'encrypt') {
|
if (op === 'encrypt') {
|
||||||
var cipher = nodeCrypto.createCipheriv('aes-256-cbc', key, iv);
|
var cipher = nodeCrypto.createCipheriv('aes-256-cbc', key, iv);
|
||||||
cipher.update(data);
|
var firstChunk = cipher.update(data);
|
||||||
resolve(cipher.final());
|
var secondChunk = cipher.final();
|
||||||
|
resolve(Buffer.concat([firstChunk, secondChunk]));
|
||||||
}
|
}
|
||||||
else if (op === 'decrypt') {
|
else if (op === 'decrypt') {
|
||||||
var decipher = nodeCrypto.createDecipheriv('aes-256-cbc', key, iv);
|
var decipher = nodeCrypto.createDecipheriv('aes-256-cbc', key, iv);
|
||||||
decipher.update(data);
|
var firstChunk = decipher.update(data);
|
||||||
resolve(decipher.final());
|
var secondChunk = decipher.final();
|
||||||
|
resolve(Buffer.concat([firstChunk, secondChunk]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user