springboot中加密密码

pom.xml

  <dependency>
            <groupId>com.github.ulisesbocchio</groupId>
            <artifactId>jasypt-spring-boot-starter</artifactId>
            <version>3.0.5</version>
        </dependency>

application.yml

jasypt:
  encryptor:
    password: xxx
    algorithm: PBEWITHHMACSHA512ANDAES_256

用jar包生成密码

java -cp jasypt-1.9.3.jar org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI password=盐 algorithm=PBEWITHHMACSHA512ANDAES_256 input=123456 ivGeneratorClassName=org.jasypt.iv.RandomIvGenerator

如果version是2.1.2
jasypt.encryptor.algorithm用默认值
java -cp jasypt-1.9.3.jar org.jasypt.intf.cli.JasyptPBEStringDecryptionCLI input=123456 password=盐 algorithm=PBEWITHHMACSHA512ANDAES_256

posted @ 2023-06-08 16:44  这都没什么  阅读(81)  评论(0编辑  收藏  举报