加密测试
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
c77ca02cbc
commit
449e999d43
|
@ -17,13 +17,13 @@ export const Encrypt = {
|
||||||
encrypt: async function (plaintext) {
|
encrypt: async function (plaintext) {
|
||||||
let PublicKey = null;
|
let PublicKey = null;
|
||||||
if (sessionStorage.getItem('PublicKey')) {
|
if (sessionStorage.getItem('PublicKey')) {
|
||||||
PublicKey = sessionStorage.getItem('PublicKey');
|
PublicKey = atob(sessionStorage.getItem('PublicKey'));
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
let res = await getPublicKey();
|
let res = await getPublicKey();
|
||||||
if (res.IsSuccess) {
|
if (res.IsSuccess) {
|
||||||
PublicKey = atob(res.Result)
|
PublicKey = atob(res.Result)
|
||||||
sessionStorage.setItem('PublicKey', PublicKey)
|
sessionStorage.setItem('PublicKey', res.Result)
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ export const Encrypt = {
|
||||||
console.log(PublicKey)
|
console.log(PublicKey)
|
||||||
let encryptor = new JSEncrypt()
|
let encryptor = new JSEncrypt()
|
||||||
encryptor.setPublicKey(PublicKey)
|
encryptor.setPublicKey(PublicKey)
|
||||||
return encryptor.encrypt(JSON.stringify(plaintext))
|
return encryptor.encrypt(plaintext)
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue