您好想使用 nodejs 中的模块 crypt 来加密一些数据
这是我的代码
toCrypt = "message";
var cipher = crypto.createCipher('aes256', key);
cipher.update(toCrypt, 'utf-8', 'base64');
var nowItisCrypted = cipher.final('base64');
var deCipher = crypto.createDecipher('aes256', key);
deCipher.update(nowItisCrypted,'base64','utf-8');
var unCrypted = deCipher.final('utf-8');
消息变量中可以包含的字符大小取决于密钥大小。如果我发送的代码太长,我会收到以下错误:
TypeError: error:0606506D:digital envelope routines:EVP_DecryptFinal_ex:wrong final block length
at Decipher.Cipher.final (crypto.js:287:27
有谁可以告诉我密钥大小和消息大小之间的关系。