https://blog.csdn.net/XZ85201/article/details/124974901
AES前端加密原文链接:https://blog.csdn.net/yingbaoyu/article/details/95761177
var data1={ name:'李雷', age:18 }//要加密的数据
var aseKey='1234567890123456789012335475';//秘钥
var key = CryptoJS.enc.Utf8.parse(aesKey);//将秘钥转换成Utf8字节数组
//加密 var encrypt = CryptoJS.AES.encrypt(JSON.stringify(data1), key, { iv: CryptoJS.enc.Utf8.parse(aseKey.substr(0,16)), mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 });
var data2=encrypt.toString();//加密后的数据
//解密
var decrypt = CryptoJS.AES.decrypt(data2, key, { iv: CryptoJS.enc.Utf8.parse(aseKey.substr(0,16)), mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 });
var data3=JSON.parse(decrypt.toString(CryptoJS.enc.Utf8));//解密后的数据
前后端AES加解密 https://blog.csdn.net/weixin_44910404/article/details/124196636
网友评论