修复EncryptUtil解密报错问题

This commit is contained in:
dgflash
2022-09-04 19:45:23 +08:00
parent 2f73a8c9db
commit 4671a36554
4 changed files with 8 additions and 13 deletions

View File

@@ -14,8 +14,8 @@ export class EncryptUtil {
*/
static aesEncrypt(msg: string, key: string, iv: string): string {
//@ts-ignore
let encrypt = CryptoJS.AES.encrypt(msg, utf8Parse(key), {
iv: this.utf8Parse(iv),
let encrypt = CryptoJS.AES.encrypt(msg, key, {
iv: iv,
//@ts-ignore
mode: CryptoJS.mode.CBC,
//@ts-ignore
@@ -32,8 +32,8 @@ export class EncryptUtil {
*/
static aesDecrypt(str: string, key: string, iv: string): string {
//@ts-ignore
let decrypt = CryptoJS.AES.decrypt(str, this.utf8Parse(key), {
iv: this.utf8Parse(iv),
let decrypt = CryptoJS.AES.decrypt(str, key, {
iv: iv,
//@ts-ignore
mode: CryptoJS.mode.CBC,
//@ts-ignore
@@ -42,9 +42,4 @@ export class EncryptUtil {
//@ts-ignore
return CryptoJS.enc.Utf8.stringify(decrypt);
}
private static utf8Parse(utf8Str: string): string {
//@ts-ignore
return CryptoJS.enc.Utf8.parse(utf8Str);
}
}

View File

@@ -10,7 +10,7 @@
"userData": {
"isPlugin": true,
"loadPluginInWeb": true,
"loadPluginInNative": false,
"executionScope": "global"
"loadPluginInNative": true,
"executionScope": "enclosed"
}
}

View File

@@ -1,5 +1,5 @@
/// <reference path="D:\CocosDashboard_1.1.0\resources\.editors\Creator\3.6.0\resources\resources\3d\engine\bin\.declarations\cc.d.ts"/>
/// <reference path="D:\CocosDashboard_1.0.6\resources\.editors\Creator\3.6.0\resources\resources\3d\engine\bin\.declarations\cc.d.ts"/>
/**
* @deprecated Global variable `cc` was dropped since 3.0. Use ES6 module syntax to import Cocos Creator APIs.

View File

@@ -1 +1 @@
/// <reference path="D:\CocosDashboard_1.1.0\resources\.editors\Creator\3.6.0\resources\resources\3d\engine\@types\jsb.d.ts"/>
/// <reference path="D:\CocosDashboard_1.0.6\resources\.editors\Creator\3.6.0\resources\resources\3d\engine\@types\jsb.d.ts"/>