TypeError: error:0606506D:digital envelope routines:EVP_DecryptFinal_ex:wrong final block length at Decipher.Cipher.final (crypto.js:292:27) at Object.module.exports.decrypt
我用crypto模块加密的数据, 在解密的时候出现了这个错误 以下是我方法源码 function encrypt(str, secret) { var cipher, enc; cipher = crypto.createCipher('aes-256-cbc’, secret); enc = cipher.update(str, 'utf8’, ‘hex’); enc += cipher.final(‘hex’); return enc; }, function decrypt(str, secret) { var dec, decipher; decipher = crypto.createDecipher('aes-256-cbc’, secret); dec = decipher.update(str, 'hex’, ‘utf8’); dec += decipher.final(‘utf8’); return dec; }