0
点赞
收藏
分享

微信扫一扫

SpringBoot配置文件密码加密(jasypt)

诗与泡面 2021-09-28 阅读 89
  • 引入依赖
    <dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>2.0.0</version>
</dependency>
  • 找到jar文件


命令行执行:

 java -cp jasypt-1.9.2.jar org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI input="123456" password=abc algorithm=PBEWithMD5AndDES

input:是数据库的明文密码
password:是机密的盐
algorithm:是加密的方式(默认)

  • 配置文件中使用:
  mail:
host: smtp.163.com
username: 18802953162@163.com # 用户名
password: ENC(0ciH5QGCy0Aww5yAcJJOfyf8iAKodNwT)

ENC加括号

举报

相关推荐

0 条评论