##使用
https://blog.csdn.net/cts529269539/article/details/79024436
maven引入jar

<dependency>
        <groupId>com.github.ulisesbocchio</groupId>
        <artifactId>jasypt-spring-boot-starter</artifactId>
        <version>1.14</version>
</dependency>

使用jasypt.jar工具加解密

//解密
java -cp jasypt-1.9.2.jar org.jasypt.intf.cli.JasyptPBEStringDecryptionCLI input="bWgq4JW/jLTBJ5kuUrR0e3s0JWEt5E7W" password=ACMP10171215 algorithm=PBEWithMD5AndDES
//加密
java -cp jasypt-1.9.2.jar org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI input="bWgq4JW/jLTBJ5kuUrR0e3s0JWEt5E7W" password=ACMP10171215 algorithm=PBEWithMD5AndDES

配置文件中将原信息替换为ENC(加密后信息),例如:

password: ENC(0V5vWSDDVLxTXEmQLNDB0CahCc+gL/Dm)

运行

运行时配置解密秘钥
-Djasypt.encryptor.password=
在idea中运行
修改配置-1

这里写图片描述
命令行启动和docker中运行参见
https://www.cnblogs.com/zz0412/p/jasypt-001.html

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐