diff --git a/App.vue b/App.vue index 3023406..9a66f58 100644 --- a/App.vue +++ b/App.vue @@ -51,6 +51,7 @@ function getUserInfo() { const sm2_privateKey = config.appInfo.sm2PrivateKey; let sm2_encrypt_result = data.data; let sm2_decrypt_result = sm2_Decrypt(sm2_encrypt_result, sm2_privateKey); + console.log(sm2_decrypt_result); if (typeof sm2_decrypt_result == 'string') sm2_decrypt_result = JSON.parse(sm2_decrypt_result); // 其次,对sm2解密后的结果进行 aes解密 diff --git a/common/globalFunction.js b/common/globalFunction.js index e67a461..a4bf4bd 100644 --- a/common/globalFunction.js +++ b/common/globalFunction.js @@ -1,3 +1,4 @@ +import '@/lib/encryption/sm4.min.js' import useUserStore from "../stores/useUserStore"; import { createRequest, @@ -7,9 +8,6 @@ import streamRequest, { chatRequest } from "../utils/streamRequest.js"; -const sm4 = typeof window.sm4 !== 'undefined' ? window.sm4 : - (typeof window.smCrypto !== 'undefined' ? window.smCrypto.sm4 : null); - export const CloneDeep = (props) => { if (typeof props !== 'object' || props === null) { return props @@ -564,7 +562,6 @@ function aes_Decrypt(word, key) { }) return decrypt.toString(CryptoJS.enc.Utf8) } - export function sm2_Decrypt(word, key) { return SM.decrypt(word, key); } @@ -588,7 +585,7 @@ export function sm4Decrypt(key, value, mode = "hex") { return decrypted } catch (e) { - console.log('解密失败') + console.log('解密失败', e) } } diff --git a/index.html b/index.html index 64927f6..2e04e64 100644 --- a/index.html +++ b/index.html @@ -24,16 +24,11 @@ - - - + - - - - -
- + + +