From 1b9c5574ff6c0f8b6a7796f27a7ebc419a038f6c Mon Sep 17 00:00:00 2001 From: Fay Date: Mon, 2 Mar 2020 16:43:00 +0800 Subject: [PATCH] =?UTF-8?q?KERNEL-2840=20=E5=A2=9E=E5=8A=A0=E4=B8=80?= =?UTF-8?q?=E4=B8=AAaes=E8=A7=A3=E5=AF=86=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/utils/aes.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/core/utils/aes.js b/src/core/utils/aes.js index 9971ebdd4..fcb9c54c5 100644 --- a/src/core/utils/aes.js +++ b/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); } }); }()); \ No newline at end of file