Springboot配置文件数据项加密

1 添加依赖



   com.github.ulisesbocchio
   jasypt-spring-boot-starter
   3.0.2

2 加密数据项
 

cd C:\Users\joniu\.m2\repository\org\jasypt\jasypt\1.9.3

java -cp jasypt-1.9.3.jar org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI input="root" password=iamsalt algorithm=PBEWithMD5AndDES

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

Runtime: Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 25.191-b12

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

algorithm: PBEWithMD5AndDES
input: root
password: iamsalt

----OUTPUT----------------------
gsnErpLPt3dG5SPnWkBIZw==

3 配置文件增加jasypt的配置(要放到spring部分的上面)

jasypt:
  encryptor:
    password: iamsalt
    # 从3.0.0jasypt-spring-boot 版本开始,默认的加密/解密算法已更改为PBEWITHHMACSHA512ANDAES_256
    algorithm: PBEWithMD5AndDES
    iv-generator-classname: org.jasypt.iv.NoIvGenerator

4 修改配置文件中的数据项

Springboot配置文件数据项加密_第1张图片

你可能感兴趣的:(spring,boot,后端,java)