Browse Source

KERNEL-2840 增加一个aes解密方法

es6
Fay 5 years ago
parent
commit
1b9c5574ff
  1. 15
      src/core/utils/aes.js

15
src/core/utils/aes.js

@ -2326,6 +2326,21 @@
var base64Cipher = cipher.ciphertext.toString(CryptoJS.enc.Base64);
return base64Cipher;
},
/**
* aes解密方法
* @param {String} text
* @param {String} key
*/
aesDecrypt: function (text, key) {
key = CryptoJS.enc.Utf8.parse(key);
var decipher = CryptoJS.AES.decrypt(text, key, {
mode: CryptoJS.mode.ECB,
padding: CryptoJS.pad.Pkcs7
});
return CryptoJS.enc.Utf8.stringify(decipher);
}
});
}());
Loading…
Cancel
Save