From a2a8ef9db8a97da7c2a85ae473dc6d2f2bb879cb Mon Sep 17 00:00:00 2001 From: Nick Walker Date: Sat, 6 Aug 2016 08:58:53 -0700 Subject: [PATCH] Fix for nodestunes crypto crash; 302. (#1) --- lib/helper.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/helper.js b/lib/helper.js index 86fefde..56d8287 100644 --- a/lib/helper.js +++ b/lib/helper.js @@ -147,7 +147,8 @@ function decryptAudioData(data,audioAesKey,audioAesIv) { const encrypted_length = block_count * BLOCK_SIZE; const remainder = data.length - encrypted_length; - const decipher = crypto.createDecipheriv('aes-128-cbc',audioAesKey,audioAesIv); + var audioAesKeyBuffer = new Buffer(audioAesKey, 'binary'); + const decipher = crypto.createDecipheriv('aes-128-cbc', audioAesKeyBuffer, audioAesIv); decipher.setAutoPadding(false); const encrypted_data = data.slice(0,encrypted_length); @@ -162,4 +163,3 @@ function decryptAudioData(data,audioAesKey,audioAesIv) { return output; }; -