mirror of
https://gitee.com/chu1204505056/vue-admin-beautiful.git
synced 2025-09-16 17:42:09 +08:00
修改rsa加密方式
This commit is contained in:
parent
6291db9dea
commit
f3780f8ccf
@ -15,6 +15,8 @@ export default [
|
|||||||
msg: "success",
|
msg: "success",
|
||||||
data: {
|
data: {
|
||||||
mockServer: true,
|
mockServer: true,
|
||||||
|
publicKey:
|
||||||
|
"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDBT2vr+dhZElF73FJ6xiP181txKWUSNLPQQlid6DUJhGAOZblluafIdLmnUyKE8mMHhT3R+Ib3ssZcJku6Hn72yHYj/qPkCGFv0eFo7G+GJfDIUeDyalBN0QsuiE/XzPHJBuJDfRArOiWvH0BXOv5kpeXSXM8yTt5Na1jAYSiQ/wIDAQAB",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -13,14 +13,13 @@ const privateKey =
|
|||||||
export async function encryptedData(data) {
|
export async function encryptedData(data) {
|
||||||
let publicKey = "";
|
let publicKey = "";
|
||||||
const res = await getPublicKey();
|
const res = await getPublicKey();
|
||||||
publicKey = res.data;
|
publicKey = res.data.publicKey;
|
||||||
if (publicKey.mockServer) {
|
if (res.data.mockServer) {
|
||||||
publicKey = "";
|
publicKey = "";
|
||||||
}
|
}
|
||||||
if (publicKey == "") {
|
if (publicKey == "") {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
const encrypt = new JSEncrypt();
|
const encrypt = new JSEncrypt();
|
||||||
encrypt.setPublicKey(
|
encrypt.setPublicKey(
|
||||||
`-----BEGIN PUBLIC KEY-----${publicKey}-----END PUBLIC KEY-----`
|
`-----BEGIN PUBLIC KEY-----${publicKey}-----END PUBLIC KEY-----`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user