Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vipSupplier
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王淑敏
vipSupplier
Commits
f3780f8c
Commit
f3780f8c
authored
Jul 21, 2020
by
初志鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改rsa加密方式
parent
6291db9d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
mock/controller/user.js
+2
-0
src/utils/encrypt.js
+2
-3
No files found.
mock/controller/user.js
View file @
f3780f8c
...
@@ -15,6 +15,8 @@ export default [
...
@@ -15,6 +15,8 @@ export default [
msg
:
"success"
,
msg
:
"success"
,
data
:
{
data
:
{
mockServer
:
true
,
mockServer
:
true
,
publicKey
:
"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDBT2vr+dhZElF73FJ6xiP181txKWUSNLPQQlid6DUJhGAOZblluafIdLmnUyKE8mMHhT3R+Ib3ssZcJku6Hn72yHYj/qPkCGFv0eFo7G+GJfDIUeDyalBN0QsuiE/XzPHJBuJDfRArOiWvH0BXOv5kpeXSXM8yTt5Na1jAYSiQ/wIDAQAB"
,
},
},
};
};
},
},
...
...
src/utils/encrypt.js
View file @
f3780f8c
...
@@ -13,14 +13,13 @@ const privateKey =
...
@@ -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-----`
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment