Неверная длина IV - PullRequest
       19

Неверная длина IV

0 голосов
/ 10 июля 2019

Ошибка длины 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

...