Open shijunsong opened 4 years ago
I am getting the below Error while encrypting the data: TypeError: undefined is not an object (evaluating 'block[i]')
Relevant Code:
const encryptUserData = (userData) => {
var CryptoJS = require("crypto-js");
var data = userData;
var key = CryptoJS.enc.Base64.parse('Secret_key');
var encrypted = CryptoJS.AES.encrypt(
data,
key,
{
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7,
});
return encrypted.toString();
}
Please help me out to resolve this issue asap. As I need to use AES encryption with PKCS5/PKCS7 padding. Thanks In Advance.
I am getting the below Error while encrypting the data: TypeError: undefined is not an object (evaluating 'block[i]')
Relevant Code:
const encryptUserData = (userData) => { var CryptoJS = require("crypto-js"); var data = userData; var key = CryptoJS.enc.Base64.parse('Secret_key'); var encrypted = CryptoJS.AES.encrypt( data, key, { mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7, }); return encrypted.toString(); }
Please help me out to resolve this issue asap. As I need to use AES encryption with PKCS5/PKCS7 padding. Thanks In Advance.
Hi, partner。 By viewing doc of java about AES, which has not support the model of PKCS7,the last, I had used the PKCS5,I'm sorry I couldn't help you。
You left out the property 'iv'. You can try:
let encrypted = cryptojs.AES.encrypt(content, utf8Key, {
iv: utf8Iv,
mode: cryptojs.mode.CBC,
padding: cryptojs.pad.ZeroPadding
})
chrome version 80+, occur this error:
my code is this:
i don't kown ,where is wrong in my code?