当前位置:网站首页>hutool对称加密
hutool对称加密
2022-06-27 06:50:00 【玲珑·】
加密逻辑
public static void main(String[] args) {
// 1. 内部先初始化静态代码块 设置非对称加密的对象 新建对象的父类会自动生成默认的公钥和私钥
RSA rsa = new RSA();
// 下面两行代码作用不大 KeyType.PublicKey 判断公钥为空的时候会自动生成
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));
}
边栏推荐
- Optimistic and pessimistic affairs
- [graduation season] graduation is the new beginning of your life journey. Are you ready
- Matlab GUI interface simulation DC motor and AC motor speed simulation
- 第 299 场周赛 第四题 6103. 从树中删除边的最小分数
- 快速实现Thread Mesh组网详解
- Configuring FTP, enterprise official website, database and other methods for ECS
- OPPO面试整理,真正的八股文,狂虐面试官
- From 5 seconds to 1 second, the system flies
- Currying Scala functions
- 2022 cisp-pte (II) SQL injection
猜你喜欢
Interviewer: you use Lombok every day. What is its principle? I can't answer
Solve the problem of win10 wsl2 IP change
SQL 注入绕过(一)
Block level elements & inline elements
2022 cisp-pte (II) SQL injection
正斜杠反斜杠的由来
Caldera installation and simple use
第 299 场周赛 第四题 6103. 从树中删除边的最小分数
OPPO面试整理,真正的八股文,狂虐面试官
如何优雅的写 Controller 层代码?
随机推荐
extendible hashing
解决 Win10 Wsl2 IP 变化问题
Quick realization of Bluetooth ibeacn function
Redis cache penetration, cache breakdown, cache avalanche
Interviewer: how to never migrate data and avoid hot issues by using sub database and sub table?
Thesis reading skills
Rust Async: smol源码分析-Executor篇
C Primer Plus Chapter 11_ Strings and string functions_ Codes and exercises
SQL injection bypass (I)
IDEA连接数据库报错
Modeling competition - optical transport network modeling and value evaluation
poi导出excle
Win10 remote connection to ECS
winow10安装Nexus nexus-3.20.1-01
Ahb2apb bridge design (2) -- Introduction to synchronous bridge design
云服务器配置ftp、企业官网、数据库等方法
The fourth question of the 299th weekly match 6103 Minimum fraction of edges removed from the tree
yarn create vite 报错 ‘D:\Program‘ 不是内部或外部命令,也不是可运行的程序 或批处理文件
Park and unpark in unsafe
一线大厂面试官问:你真的懂电商订单开发吗?