From 1b97b5c7ff17289779639e4b5f6fdc60c46178a5 Mon Sep 17 00:00:00 2001 From: Justin Tormey Date: Thu, 4 Feb 2016 22:24:17 -0500 Subject: [PATCH] fix(WalletCrypto): use correct key block size when padding with Iso10126 --- src/wallet-crypto.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet-crypto.js b/src/wallet-crypto.js index cf5fbfb07..746b55b1a 100644 --- a/src/wallet-crypto.js +++ b/src/wallet-crypto.js @@ -101,7 +101,7 @@ var AES = { var cipher = crypto.createCipheriv(options.mode || AES.CBC, key, salt || ''); cipher.setAutoPadding(!options.padding); - if (options.padding) dataBytes = options.padding.pad(dataBytes, KEY_BIT_LEN); + if (options.padding) dataBytes = options.padding.pad(dataBytes, KEY_BIT_LEN / 8); var encryptedBytes = Buffer.concat([ cipher.update(dataBytes), cipher.final() ]); return encryptedBytes;