当前位置:网站首页>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));
}
边栏推荐
- Idea方法模板
- Process termination (have you really learned recursion? Test your recursion Foundation)
- Write an example of goroutine and practice Chan at the same time
- The interviewer of a large front-line factory asked: do you really understand e-commerce order development?
- 2022 cisp-pte (I) document contains
- POI export excle
- 高薪程序员&面试题精讲系列116之Redis缓存如何实现?怎么发现热key?缓存时可能存在哪些问题?
- 【LeetCode】Day90-二叉搜索树中第K小的元素
- Solve the problem of win10 wsl2 IP change
- 一個人管理1000臺服務器?這款自動化運維工具一定要掌握
猜你喜欢

面试官:请你介绍一下缓存穿透、缓存空值、缓存雪崩、缓存击穿的,通俗易懂

Interviewer: please introduce cache penetration, cache null value, cache avalanche and cache breakdown, which are easy to understand

从5秒优化到1秒,系统飞起来了...

面试官:大量请求 Redis 不存在的数据,从而打倒数据库,你有什么方案?

Fast implementation of thread mesh networking

OPPO面试整理,真正的八股文,狂虐面试官

C# 请问怎么在更新数据库时候调用line与rows

AHB2APB桥接器设计(2)——同步桥设计的介绍

Solve the problem of win10 wsl2 IP change

Memory barrier store buffer, invalid queue
随机推荐
DMU software syntax highlighting VIM setting -- Learning Notes 6
攻防演习防御体系构建之第二篇之应对攻击的常用策略
thrift
vs怎么配置OpenCV?2022vs配置OpenCV详解(多图)
Currying Scala functions
Yolov6's fast and accurate target detection framework is open source
数据库系统工程师对口专业有哪些?
Easyexcel: read Excel data into the list set
Bean拷贝详解
Instance Tunnel 使用
一线大厂面试官问:你真的懂电商订单开发吗?
Rust Async: smol源码分析-Executor篇
Unsafe中的park和unpark
One year's experience of technical personnel in Entrepreneurship
How to download opencv? How to configure opencv after downloading?
第 299 场周赛 第四题 6103. 从树中删除边的最小分数
Transaction overview of tidb
Winow10 installation nexus nexus-3.20.1-01
延时队列`DelayQueue`
winow10安装Nexus nexus-3.20.1-01