Jasypt 是一个 Java 库,它允许开发者以最小的努力为他 / 她的项目添加基本的加密功能,而且不需要对密码学的工作原理有深刻的了解。
地址: https://github.com/jasypt/jasypt
一、添加依赖
<dependency> <groupId>com.github.ulisesbocchio</groupId> <artifactId>jasypt-spring-boot-starter</artifactId> <version>2.1.0</version> </dependency>
二、生成加密数据
1.根据 jasypt-spring-boot-starter
的父级POM, 找到jasypt的依赖路径,我这里看到如下:
<dependency> <groupId>org.jasypt</groupId> <artifactId>jasypt</artifactId> <version>${jasypt.version}</version> </dependency>
2.然后通过上面的依赖路径,在本地Maven仓库中找到jasypt的jar包,通过CMD执行下面操作:
java -cp jasypt-1.9.2.jar org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI input="abc123" password=test algorithm=PBEWithMD5AndDES
3.结果如下:
E:\repository\org\jasypt\jasypt