diff --git a/lib/file_transfer_agent/encrypt_util.js b/lib/file_transfer_agent/encrypt_util.js index c26544221..62bb12029 100644 --- a/lib/file_transfer_agent/encrypt_util.js +++ b/lib/file_transfer_agent/encrypt_util.js @@ -149,8 +149,8 @@ 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); @@ -158,7 +158,7 @@ function EncryptUtil(encrypt, filestream, temp) { 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 {