Skip to content

Commit

Permalink
Change decodedKey -> decodedKek
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-dheyman committed Nov 19, 2024
1 parent b222951 commit 65897da
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/file_transfer_agent/encrypt_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,16 @@ function EncryptUtil(encrypt, filestream, temp) {
};

this.encryptDataCBC = function (encryptionMaterial, data) {
const decodedKey = Buffer.from(encryptionMaterial[QUERY_STAGE_MASTER_KEY], BASE64);
const keySize = decodedKey.length;
const decodedKek = Buffer.from(encryptionMaterial[QUERY_STAGE_MASTER_KEY], BASE64);
const keySize = decodedKek.length;

const dataIv = getSecureRandom(AES_CBC.ivSize);
const fileKey = getSecureRandom(keySize);

const dataCipher = crypto.createCipheriv(AES_CBC.cipherName(keySize), fileKey, dataIv);
const encryptedData = performCrypto(dataCipher, data);

const keyCipher = crypto.createCipheriv(AES_ECB.cipherName(keySize), decodedKey, null);
const keyCipher = crypto.createCipheriv(AES_ECB.cipherName(keySize), decodedKek, null);
const encryptedKey = performCrypto(keyCipher, fileKey);

return {
Expand Down

0 comments on commit 65897da

Please sign in to comment.