Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nlt-pufa-interface
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
邓梁
nlt-pufa-interface
Commits
3f041f35
Commit
3f041f35
authored
Sep 26, 2024
by
dliangx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
签名函数修改
parent
9ee05aca
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
model/http_body.go
+6
-5
No files found.
model/http_body.go
View file @
3f041f35
...
...
@@ -72,10 +72,11 @@ func EncryptAndSign[T any](resp HttpBodyResp[T]) (CryptHttpBodyResp, error) {
log
.
Println
(
err
)
return
cresp
,
err
}
rBytes
:=
r
.
Bytes
()
sBytes
:=
s
.
Bytes
()
signature
:=
append
(
rBytes
,
sBytes
...
)
signature
,
err
:=
sm2
.
SignDigitToSignData
(
r
,
s
)
if
err
!=
nil
{
log
.
Println
(
err
)
return
cresp
,
err
}
cresp
.
Signature
=
signature
return
cresp
,
err
}
...
...
@@ -84,7 +85,7 @@ func VerifyAndDecrypt[T any](creq CryptHttpBodyReq) (HttpBodyReq[T], error) {
var
req
HttpBodyReq
[
T
]
privateKeyBytes
,
_
:=
sm2
.
GenerateKey
(
strings
.
NewReader
(
nltconst
.
SM2_PRIVATE_KEY
))
signature
:=
creq
.
Signature
r
,
s
,
err
:=
sm2
.
SignDataToSignDigit
(
[]
byte
(
signature
)
)
r
,
s
,
err
:=
sm2
.
SignDataToSignDigit
(
signature
)
if
err
!=
nil
{
log
.
Println
(
err
)
return
req
,
err
...
...
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