话不多说导入jar包
<dependency>
<groupId>com.melloware</groupId>
<artifactId>jasypt</artifactId>
<version>1.9.4</version>
</dependency>
input 为需要加密的明文密码;
password 为私钥;
algorithm 为固定规则。
ENC加密
String[] createStr = new String[]{
"input=abc123", "password=test", "algorithm=PBEWithMD5AndDES"};
JasyptPBEStringEncryptionCLI.main(createStr)