From 449e999d43a55569f7d229b7645b73e2e7a15e16 Mon Sep 17 00:00:00 2001 From: "DESKTOP-6C3NK6N\\WXS" <815034831@qq.com> Date: Thu, 19 Sep 2024 17:34:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=AF=86=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/encrypt/crypto.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/encrypt/crypto.js b/src/utils/encrypt/crypto.js index 7b55ad35..5c085683 100644 --- a/src/utils/encrypt/crypto.js +++ b/src/utils/encrypt/crypto.js @@ -17,13 +17,13 @@ export const Encrypt = { encrypt: async function (plaintext) { let PublicKey = null; if (sessionStorage.getItem('PublicKey')) { - PublicKey = sessionStorage.getItem('PublicKey'); + PublicKey = atob(sessionStorage.getItem('PublicKey')); } else { try { let res = await getPublicKey(); if (res.IsSuccess) { PublicKey = atob(res.Result) - sessionStorage.setItem('PublicKey', PublicKey) + sessionStorage.setItem('PublicKey', res.Result) } else { return false; } @@ -34,7 +34,7 @@ export const Encrypt = { console.log(PublicKey) let encryptor = new JSEncrypt() encryptor.setPublicKey(PublicKey) - return encryptor.encrypt(JSON.stringify(plaintext)) + return encryptor.encrypt(plaintext) },