bitauth icon indicating copy to clipboard operation
bitauth copied to clipboard

Node 0.12.0 has 'bad decrypt' error

Open sheldonth opened this issue 9 years ago • 2 comments

Attempting to use bitauth as part of the bitpay node.js module, and seeing

crypto.js:202
  var ret = this._handle.final();
                         ^
Error: error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt
    at Error (native)
    at Decipher.Cipher.final (crypto.js:202:26)
    at Object.decrypt (/home/.../node_modules/bitauth/lib/decrypt.js:7:23)
    at new Bitpay (/home/.../bitpay.js:53:27)

Has this been encountered yet? Was not having this problem on Node 0.10.33, seems new to 0.12.0

sheldonth avatar Mar 16 '15 15:03 sheldonth

The offending code, in detail

keyPath = '/.bitpay/api.key' if not keyPath?
@encryptedPKey = (fs.readFileSync H + keyPath).toString()
@log.error "no bitpay private key present" if not @encryptedPKey?
@pKey = bitauth.decrypt '', @encryptedPKey
@client = bitpay.createClient @pKey

sheldonth avatar Mar 16 '15 15:03 sheldonth

try:

keyPath = keyPath || '/.bitpay/api.key'

bharathrao avatar May 27 '15 05:05 bharathrao