jasypt对配置文件加密解密
使用https://blog.csdn.net/cts529269539/article/details/79024436运行运行时配置解密秘钥在idea中运行命令行启动和docker中运行参见https://www.cnblogs.com/zz0412/p/jasypt-001.html...
·
##使用
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中运行
命令行启动和docker中运行参见
https://www.cnblogs.com/zz0412/p/jasypt-001.html
更多推荐
已为社区贡献2条内容
所有评论(0)