|
|
@@ -194,15 +194,19 @@ export const decryptBody = (base64: string) => {
|
|
|
* @param encryptData 密文
|
|
|
* @param size 明文长度
|
|
|
*/
|
|
|
-export const decryptAES = (value: string): string | undefined => {
|
|
|
- const ciphertext = hexStringToUint8Array(value);
|
|
|
- const key = hexStringToUint8Array(phoneaeskey);
|
|
|
-
|
|
|
- const cipherParams = CryptoJS.lib.CipherParams.create({
|
|
|
- ciphertext: uint8ArrayToWordArray(ciphertext),
|
|
|
- });
|
|
|
-
|
|
|
- const decrytped = CryptoJS.AES.decrypt(cipherParams, uint8ArrayToWordArray(key), aesOption);
|
|
|
- const h = wordArrayToUint8Array(decrytped);
|
|
|
- return new TextDecoder().decode(h);
|
|
|
+export const decryptAES = (value: string) => {
|
|
|
+ try {
|
|
|
+ const ciphertext = hexStringToUint8Array(value);
|
|
|
+ const key = hexStringToUint8Array(phoneaeskey);
|
|
|
+
|
|
|
+ const cipherParams = CryptoJS.lib.CipherParams.create({
|
|
|
+ ciphertext: uint8ArrayToWordArray(ciphertext),
|
|
|
+ });
|
|
|
+
|
|
|
+ const decrytped = CryptoJS.AES.decrypt(cipherParams, uint8ArrayToWordArray(key), aesOption);
|
|
|
+ const h = wordArrayToUint8Array(decrytped);
|
|
|
+ return new TextDecoder().decode(h);
|
|
|
+ } catch {
|
|
|
+ return ''
|
|
|
+ }
|
|
|
}
|