美文网首页javaWeb学习
SpringBoot配置文件密码加密(jasypt)

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

作者: 皮多堡 | 来源:发表于2019-07-16 20:29 被阅读0次
  • 引入依赖
    <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加括号

相关文章

网友评论

    本文标题:SpringBoot配置文件密码加密(jasypt)

    本文链接:https://www.haomeiwen.com/subject/rulmaqtx.html