jasypt

1.Pom加入依赖

    com.github.ulisesbocchio

    jasypt-spring-boot-starter

    2.1.0

    

    

    

2.在本机JDK/bin目录下用命令生成加密密码(其中password=panther 为 盐值(key),input=eisinfra 为需要加密的值)

java -cp C:\Users\e662534\.m2\repository\org\jasypt\jasypt\1.9.0\jasypt-1.9.0.jar org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI password=panther algorithm=PBEWithMD5AndDES input=pq97ybdFF&w*1h%3

3.将生成的密码配置在配置文件application.yml中,用ENC()包裹密码

password: ENC(aRzTh8ypM7K2Gs9P7h4dSxSR3671kj4q)

fgHnMUg88MSwpR+ZPB5k/6666/fkNdYJ

4.在项目中配置盐值,或者直接在配置文件中配置(jasypt.encryptor.password=panther)

IDEA中配置:

eclipse中在run configurations中加盐值

你可能感兴趣的:(jasypt)