具体版本,可以从 Maven Central 查询
<dependency> <groupId>com.heanbian</groupId> <artifactId>heanbian-crypto</artifactId> <version>2025.8</version> </dependency>
-
AesTemplate
AesTemplate aes = new AesTemplate();
// 加密
String ciphertext = aes.encrypt("hello world");
System.out.println("Encrypted: " + ciphertext);
// 解密
String plaintext = aes.decrypt(ciphertext);
// 输出 hello world
System.out.println("Decrypted: " + plaintext);
-
EcTemplate
EcTemplate ec = new EcTemplate();
// 加密
String ciphertext = ec.encrypt("hello world");
System.out.println("Encrypted: " + ciphertext);
// 解密
String plaintext = ec.decrypt(ciphertext);
// 输出 hello world
System.out.println("Decrypted: " + plaintext);
-
RsaTemplate
RsaTemplate rsa = new RsaTemplate();
// 加密
String ciphertext = rsa.encrypt("hello world");
System.out.println("Encrypted: " + ciphertext);
// 解密
String plaintext = rsa.decrypt(ciphertext);
// 输出 hello world
System.out.println("Decrypted: " + plaintext);
-
SM4Template
SM4Template sm4 = new SM4Template();
// 加密
String ciphertext = sm4.encrypt("hello world");
System.out.println("Encrypted: " + ciphertext);
// 解密
String plaintext = sm4.decrypt(ciphertext);
// 输出 hello world
System.out.println("Decrypted: " + plaintext);
说明:支持EC、RSA、AES、SM4。