Commit f3780f8c by 初志鑫

修改rsa加密方式

parent 6291db9d
......@@ -15,6 +15,8 @@ export default [
msg: "success",
data: {
mockServer: true,
publicKey:
"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDBT2vr+dhZElF73FJ6xiP181txKWUSNLPQQlid6DUJhGAOZblluafIdLmnUyKE8mMHhT3R+Ib3ssZcJku6Hn72yHYj/qPkCGFv0eFo7G+GJfDIUeDyalBN0QsuiE/XzPHJBuJDfRArOiWvH0BXOv5kpeXSXM8yTt5Na1jAYSiQ/wIDAQAB",
},
};
},
......
......@@ -13,14 +13,13 @@ const privateKey =
export async function encryptedData(data) {
let publicKey = "";
const res = await getPublicKey();
publicKey = res.data;
if (publicKey.mockServer) {
publicKey = res.data.publicKey;
if (res.data.mockServer) {
publicKey = "";
}
if (publicKey == "") {
return data;
}
const encrypt = new JSEncrypt();
encrypt.setPublicKey(
`-----BEGIN PUBLIC KEY-----${publicKey}-----END PUBLIC KEY-----`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment