ToolsOhのjasypt编码(加密)(KT:java、jasypt)

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

END

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值