Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
elearn
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
hqzhdj
elearn
Commits
6eb2e50d
Commit
6eb2e50d
authored
Jun 02, 2021
by
胡涛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
b76b0af6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
13 deletions
+2
-13
cloud-util/src/main/java/com/yizhi/util/application/sm2/SM2_NEW.java
+2
-13
No files found.
cloud-util/src/main/java/com/yizhi/util/application/sm2/SM2_NEW.java
View file @
6eb2e50d
...
...
@@ -5,6 +5,7 @@ import lombok.AllArgsConstructor;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.RandomStringUtils
;
import
org.bouncycastle.asn1.gm.GMNamedCurves
;
import
org.bouncycastle.asn1.x9.X9ECParameters
;
import
org.bouncycastle.crypto.AsymmetricCipherKeyPair
;
...
...
@@ -330,18 +331,6 @@ public class SM2_NEW {
return
random
;
}
public
static
void
main
(
String
[]
args
)
{
logger
.
info
(
"privateD:"
+
privateKeyD
);
logger
.
info
(
"privateD:"
+
new
BigInteger
(
""
,
16
));
// String encryptString = "046dd626ec8566bec5fe5f6a61a222da41834580e4cd1b43d39ed1e28758d0d4a2b2ff1b4d3506009ff0e5bc7f12e889585231e35de2641f68735c023d5c68e8f124654f753d09b3efe85612ad81473af41985161fcd5f3351f42d9edfe281742ff414386d657bfa7a30b99d6c06136b611af6ab80c8079181";
String
encryptString
=
"0468f98b80edc06de7c7023858c11ace20695c88aa7b2f9f79de735c6e4e6b462c6481af33cdbf3a44f69abc6acfedb27742d04fedae54c0132f3ccf47cb35e0a7ba03f28c38597a064c07d792ed1e886178ccbcf62201beafe4321bd02f988130471e266069fa8a4098058cb72ee443d26eb4a91e"
;
// System.out.println("orginalString:" + orginalString);
// String encryptString = encrypt("shyz");
System
.
out
.
println
(
"encryptString:"
+
encryptString
);
String
decryptString
=
decryptWithSalt
(
encryptString
);
System
.
out
.
println
(
"decryptString:"
+
decryptString
);
}
// public static void main(String[] args) {
//
...
...
@@ -373,7 +362,7 @@ public class SM2_NEW {
String
result
=
null
;
try
{
byte
[]
arrayOfBytes
=
sm2Engine
.
processBlock
(
cipherDataByte
,
0
,
cipherDataByte
.
length
);
result
=
new
String
(
arrayOfBytes
,
StandardCharsets
.
UTF_8
);
result
=
new
String
(
arrayOfBytes
,
StandardCharsets
.
UTF_8
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"解密参数异常:"
+
cipherData
);
e
.
printStackTrace
();
...
...
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