Decrypting AES256 with node.js returns wrong final block length

前端 未结 3 1835
猫巷女王i
猫巷女王i 2020-11-27 06:45

Using this Gist I was able to successfully decrypt AES256 in Node.js 0.8.7. Then when I upgraded to Node.js 0.10.24, I now see this error:

TypeError:

3条回答
  •  遥遥无期
    2020-11-27 07:09

    My issue was that the string I was passing to my decrypt function was empty. I built in a check for empty strings and I did not receive the message again.

    decrypt: function(text){
                    if(text.length == 0){
                        return text;
                    }
                    return this.decipher.update(text, 'hex', 'utf8') + this.decipher.final('utf8');
                }
    

提交回复
热议问题