我创建了一个函数来解密,但是在解密的时候一些字符被破坏了。这个问题可能是什么引起的?
{“text”:“aynīsī "}
1999年12月15日,纽约
{“text”:“aynìs "}
const encryptionType = 'aes-256-cbc';
const encryptionEncoding = 'base64';
const encryptionEncodingHex = 'hex';
const bufferEncryption = 'utf-8';
const decryptJwt = (cipherText) => {
const buff = Buffer.from(cipherText, encryptionEncoding);
const KEY = Buffer.from(SECRET, bufferEncryption);
const IV = Buffer.alloc(16);
const decipher = crypto.createDecipheriv(encryptionType, KEY, IV);
const deciphered = decipher.update(buff).toString(bufferEncryption) + decipher.final().toString(bufferEncryption);
return deciphered;
};
1条答案
按热度按时间ruoxqz4g1#
我修正: