校园网站开发类论文,深圳最新消息今天新增,网站建设所需的基本内容,建设联结是不是正规网站时间 2023-11-01 使用Jasypt3.0.3版本对SpringBoot配置文件加密 目录 引入依赖使用密钥生成密文配置yml验证是否自动解密 引入依赖 !--yml 文件加解密--dependencygroupIdcom.github.ulisesbocchio/groupIdartifactIdjasypt-spring-b…时间 2023-11-01 使用Jasypt3.0.3版本对SpringBoot配置文件加密 目录 引入依赖使用密钥生成密文配置yml验证是否自动解密 引入依赖 !--yml 文件加解密--dependencygroupIdcom.github.ulisesbocchio/groupIdartifactIdjasypt-spring-boot-starter/artifactIdversion3.0.3/version/dependency使用密钥生成密文 Testpublic void testEncrypt(){BasicTextEncryptor textEncryptor new BasicTextEncryptor();// 加密密钥textEncryptor.setPassword(123456);String username textEncryptor.encrypt(your-username);String password textEncryptor.encrypt(your-password);System.out.println(username: username);System.out.println(password: password);}输出结果
username:i8QgEN4uOy2E1rHzrpSTYA
password:6eaMh/RX5oXUVca9ignvtg配置yml
# yml文件敏感信息加解密
jasypt:encryptor:property:prefix: ENC(suffix: )password: 123456algorithm: PBEWithMD5AndDESstring-output-type: Stringiv-generator-classname: org.jasypt.iv.NoIvGeneratorspring:datasource:usernameENC(i8QgEN4uOy2E1rHzrpSTYA)passwordENC(6eaMh/RX5oXUVca9ignvtg)验证是否自动解密
能在本地启动程序就算成功。
部署时配置密钥值为了防止密钥泄露,反解出密码.可以在项目部署的时候使用命令传入密钥值
java -jar -Djasypt.encryptor.password123456 xxx.jar