admin管理员组

文章数量:1530256

<dependency>

    <groupId>com.github.ulisesbocchio</groupId>

    <artifactId>jasypt-spring-boot-starter</artifactId>

    <version>3.0.3</version>

</dependency>

先将要加密的内容进

java -cp D:\opensource\repository\org\jasypt\jasypt\1.9.2\jasypt-1.9.2.jar org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI input="root" password="abc" algorithm="PBEWithMD5AndDES"

password是“自己加密时的盐”

algorithm是“自己的加密方式”

D:\opensource\repository\org\jasypt\jasypt\1.9.2\jasypt-1.9.2.jar是我电脑上那个jar包所在位置。

加密出来的结果如图所示:

spring:
  datasource:
    url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&useSSL=false
    username: ENC(8FzbF7+Fcfz6Zi2tV64Ekg==)
    password: ENC(8FzbF7+Fcfz6Zi2tV64Ekg==)
    driver-class-name: com.mysql.jdbc.Driver
jasypt:
  encryptor:
    password: abc #加密盐值
    algorithm: PBEWithMD5AndDES #加密算法设置
    iv-generator-classname: org.jasypt.iv.NoIvGenerator

本文标签: 文件加密数据库mysql