实践Jasypt

jasypt

jasypt-spring-boot

对明文参数进行加密,例如使用密钥test123对mysql进行加密得到密文AalZ8yu+F1RuYK/oUma2cw==

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$ java -cp org/jasypt/jasypt/1.9.2/jasypt-1.9.2.jar org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI input="mysql" password=test123 algorithm=PBEWithMD5AndDES

----ENVIRONMENT-----------------

Runtime: Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 25.152-b16 



----ARGUMENTS-------------------

algorithm: PBEWithMD5AndDES
input: mysql
password: test123



----OUTPUT----------------------

AalZ8yu+F1RuYK/oUma2cw==

配置密钥

1
jasypt.encryptor.password=test123

配置密文参数

1
dataSource.myDS.password=ENC(AalZ8yu+F1RuYK/oUma2cw==)