File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed
Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -252,7 +252,9 @@ const loginHandle = () => {
252252 })
253253 } else {
254254 const publicKey = forge .pki .publicKeyFromPem (chatUser ?.chat_profile ?.rasKey as any );
255- const encrypted = publicKey .encrypt (JSON .stringify (loginForm .value ), ' RSAES-PKCS1-V1_5' );
255+ const jsonData = JSON .stringify (loginForm .value );
256+ const utf8Bytes = forge .util .encodeUtf8 (jsonData );
257+ const encrypted = publicKey .encrypt (utf8Bytes , ' RSAES-PKCS1-V1_5' );
256258 const encryptedBase64 = forge .util .encode64 (encrypted );
257259 chatUser .login ({
258260 encryptedData: encryptedBase64 ,
@@ -438,10 +440,10 @@ onBeforeMount(() => {
438440 console .log (' DingTalk client request success:' , res )
439441 chatUser .dingOauth2Callback (res .code , accessToken ).then (() => {
440442 router .push ({
441- name: ' chat' ,
442- params: {accessToken: accessToken },
443- query: route .query ,
444- })
443+ name: ' chat' ,
444+ params: {accessToken: accessToken },
445+ query: route .query ,
446+ })
445447 })
446448 })
447449 }
Original file line number Diff line number Diff line change @@ -201,7 +201,10 @@ const loginHandle = () => {
201201 })
202202 } else {
203203 const publicKey = forge .pki .publicKeyFromPem (user .rasKey );
204- const encrypted = publicKey .encrypt (JSON .stringify (loginForm .value ), ' RSAES-PKCS1-V1_5' );
204+ // 转换为UTF-8编码后再加密
205+ const jsonData = JSON .stringify (loginForm .value );
206+ const utf8Bytes = forge .util .encodeUtf8 (jsonData );
207+ const encrypted = publicKey .encrypt (utf8Bytes , ' RSAES-PKCS1-V1_5' );
205208 const encryptedBase64 = forge .util .encode64 (encrypted );
206209 login
207210 .asyncLogin ({encryptedData: encryptedBase64 , username: loginForm .value .username })
You can’t perform that action at this time.
0 commit comments