Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
YZG
yzg-util
Commits
da48caf3
Commit
da48caf3
authored
Nov 18, 2020
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改实体位置
parent
8df3226a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
RsaHelper.java
.../src/main/java/com/yanzuoguang/util/helper/RsaHelper.java
+12
-0
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/RsaHelper.java
View file @
da48caf3
...
@@ -16,6 +16,18 @@ import java.security.spec.X509EncodedKeySpec;
...
@@ -16,6 +16,18 @@ import java.security.spec.X509EncodedKeySpec;
/**
/**
* RSA
* RSA
* # 知识点
* 1. 从一个固定长度的字节数组转换为另外一个固定长度的字节数组。如117的加密对应128的解密
* 2. RSA分为公钥+私钥
* 3. 可以用公钥加密+私钥解密 或者 私钥加密+公钥解密
* 4. 因为加密只有字节,所以需要转换为base64
* <p>
* # 流程
* 1. 生成公钥私钥
* 2. 将公钥转换为字节,然后转换为base64字符串
* 3. 将私钥转换为字节,然后转换为base64字符串
* 4. 将来源字符串转换为字节,并按照固定加密长度截断,依次用公钥字符串生成的公钥进行加密。将加密后的字节转换为base64字符串。
* 5. 将需要解密的字符串转换为字节,按照固定解密长度阶段,依次用私钥字符串生成的私钥进行解密。
*
*
* @author 颜佐光
* @author 颜佐光
*/
*/
...
...
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