美文网首页
CryptoJS TripleDes加密后输出Base64

CryptoJS TripleDes加密后输出Base64

作者: 牛年大吉2021 | 来源:发表于2021-04-26 15:05 被阅读0次

1、不带mode和padding的方法不能使用,需要使用下面的;
2、key的值要进行转换一下编码;
3、toString()默认输出即为Base64编码的。

const KeyHex = CryptoJS.enc.Utf8.parse(sysConfig.DES_KEY); // key
const base64 = CryptoJS.TripleDES.encrypt(jsonData,KeyHex, {
                mode: CryptoJS.mode.ECB,
                padding: CryptoJS.pad.Pkcs7
}).toString();

相关文章

网友评论

      本文标题:CryptoJS TripleDes加密后输出Base64

      本文链接:https://www.haomeiwen.com/subject/dsrerltx.html