From a937a2b5a5e42fa225cf35c3b670294afe28dc99 Mon Sep 17 00:00:00 2001 From: Jack Peterson Date: Fri, 7 Apr 2017 22:02:17 -0700 Subject: [PATCH] Minor recover tweak --- index.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index a59797b..742af9e 100644 --- a/index.js +++ b/index.js @@ -426,15 +426,11 @@ module.exports = { return Buffer.from(self.decrypt(ciphertext, key, iv, algo), "hex"); } - iv = keyObjectCrypto.cipherparams.iv; - salt = keyObjectCrypto.kdfparams.salt; - ciphertext = keyObjectCrypto.ciphertext; + iv = this.str2buf(keyObjectCrypto.cipherparams.iv); + salt = this.str2buf(keyObjectCrypto.kdfparams.salt); + ciphertext = this.str2buf(keyObjectCrypto.ciphertext); algo = keyObjectCrypto.cipher; - iv = this.str2buf(iv); - salt = this.str2buf(salt); - ciphertext = this.str2buf(ciphertext); - if (keyObjectCrypto.kdf === "pbkdf2" && keyObjectCrypto.kdfparams.prf !== "hmac-sha256") { throw new Error("PBKDF2 only supported with HMAC-SHA256"); }