From f97ad5dbe56cda6de3835f5fff0a5c191fa041d5 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 16 Mar 2016 13:03:11 +0000 Subject: [PATCH] Do not fail on an invalid input for EtherWallet --- thirdparty.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/thirdparty.js b/thirdparty.js index 67e2b20..7cf0b03 100644 --- a/thirdparty.js +++ b/thirdparty.js @@ -109,6 +109,10 @@ Thirdparty.fromEtherWallet = function (input, password) { // decode openssl ciphertext + salt encoding cipher = decodeCryptojsSalt(cipher) + if (!cipher.salt) { + throw new Error('Unsupported EtherWallet key format') + } + // derive key/iv using OpenSSL EVP as implemented in CryptoJS var evp = evp_kdf(new Buffer(password), cipher.salt, { keysize: 32, ivsize: 16 })