当前位置:网站首页>Hutool symmetric encryption
Hutool symmetric encryption
2022-06-27 07:16:00 【Exquisite·】
Encryption logic
public static void main(String[] args) {
// 1. Initialize the static code block internally Set asymmetric encrypted object The parent class of the new object will automatically generate the default public key and private key
RSA rsa = new RSA();
// The following two lines of code don't do much KeyType.PublicKey When the public key is judged to be empty, it will be automatically generated
PrivateKey privateKey = rsa.getPrivateKey();
PublicKey publicKey = rsa.getPublicKey();
String s = rsa.encryptBcd("hello world", KeyType.PublicKey);
byte[] decrypt = rsa.decrypt(s, KeyType.PrivateKey);
System.out.println(StrUtil.str(decrypt,CharsetUtil.UTF_8));
}
边栏推荐
- Easyexcel: read Excel data into the list set
- 面试官:你天天用 Lombok,说说它什么原理?我竟然答不上来…
- guava 定时任务
- From 5 seconds to 1 second, the system flies
- C# 请问怎么在更新数据库时候调用line与rows
- Tar: /usr/local: cannot find tar in the Archive: due to the previous error, it will exit in the last error state
- Solve the problem of win10 wsl2 IP change
- 一个人管理1000台服务器?这款自动化运维工具一定要掌握
- webscoket 数据库监听
- 获取地址url中的query参数指定参数方法
猜你喜欢

2022 CISP-PTE(一)文件包含

2022 CISP-PTE(二)SQL注入

Interviewer: do you have any plan to request a lot of data that does not exist in redis to destroy the database?

正斜杠反斜杠的由来

thrift

第 299 场周赛 第四题 6103. 从树中删除边的最小分数

面试官:你天天用 Lombok,说说它什么原理?我竟然答不上来…

Classical cryptosystem -- substitution and replacement

Idea one click log generation

【Kevin三连弹之三】Rust真的比C慢吗?进一步分析queen微测评
随机推荐
Tar: /usr/local: cannot find tar in the Archive: due to the previous error, it will exit in the last error state
用XGBoost迭代读取数据集
POI replacing text and pictures in docx
Ora-00909: invalid number of parameters, caused by concat
Instance Tunnel 使用
内存屏障今生之Store Buffer, Invalid Queue
Solve the problem of win10 wsl2 IP change
The song of cactus -- throwing stones to ask the way (1)
面试官:你天天用 Lombok,说说它什么原理?我竟然答不上来…
在线文本数字识别列表求和工具
Spark SQL common time functions
Maxcompute SQL 的查询结果条数受限1W
【Kevin三连弹之三】Rust真的比C慢吗?进一步分析queen微测评
HTAP in depth exploration Guide
R 语言Analyzing wine data
The fourth question of the 299th weekly match 6103 Minimum fraction of edges removed from the tree
Interviewer: how to never migrate data and avoid hot issues by using sub database and sub table?
【OpenAirInterface5g】RRC NR解析之RrcSetupComplete
Interviewer: do you have any plan to request a lot of data that does not exist in redis to destroy the database?
oracle的similarity方法实现原理