❑ToolsOh!の【jasypt编码(加密)】工具的功能
所在位置:ToolsOh/开发者工具/jasypt编码(加密)
主要技术:java、jasypt
1、功能简介
对秘钥、密码等明文加密。
2、输入、输出
略
3、程序(算法)说明
maven代码(与springboot结合版本)
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>2.1.0</version>
</dependency>
java代码
import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
/**
* @Description:使用Jasypt生成密码
* @author:
* @date:
*/
public class JasyptPBEStringEncryptionGen {
public static void main(String[] args) {
StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
//加密所需的salt(盐)
//encryptor.setPassword("62a8xxxxxxxxxxxxx0ca18a2f824" + System.getProperty("KEY_NUM"));
encryptor.setPassword("62a8xxxxxxxxxxxxx0ca18a2f824");
//要加密的数据(数据库的密码)
String password = encryptor.encrypt("www.toolsoh.com");
System.out.println(String.format("加密后【%s】", password));
// 解密
String decryptPassword = encryptor.decrypt(password);
System.out.println(String.format("解密后【%s】", decryptPassword));
}
}
测试结果
加密后【D4kthLeiIdGs7LTyX9a/kNZZSryMbIC6】
解密后【www.toolsoh.com】
4、关键业务流程
略
❑用户界面
1、成品演示
https://www.toolsoh.com/p/t/dev/jasyptbianma-jasyptencrypt.html
https://www.toolsoh.com/p/t/dev/jasyptjiema-jasyptdecrypt.html
2、界面展示
❑致谢开源
- 开源项目作者: ulisesbocchio
- 开源项目名称: jasypt-spring-boot
- 开源项目地址: https://github.com/ulisesbocchio/jasypt-spring-boot 去star
- 开源项目描述: Jasypt integration for Spring boot