无效的IV长度

时间:2019-07-10 09:19:49

标签: javascript node.js jwt cryptojs

尝试在我的应用程序中使用社交网络登录时,Gettint IV长度错误。

Apache 2.4.39 PHP 7.2.18

this.cipherKey = crypto.createHash('sha256')
    .update(this.authorize.secret)
    .digest();

Authorize.prototype.encrypt = function encrypt(text) {
    let iv = crypto.randomBytes(16);
    let cipher = crypto.createCipheriv(this.authorize.algorithm, new Buffer.from(this.cipherKey), iv);
    let encrypted = cipher.update(text);
    encrypted = Buffer.concat([encrypted, cipher.final()]);
    return iv.toString('hex') + ':' + encrypted.toString('hex');
  

错误:无效的IV长度

0 个答案:

没有答案