Skip to content

heanbian/heanbian-crypto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

125 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

heanbian-crypto

前提条件

JDK 25+

pom.xml

具体版本,可以从 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。

Releases

No releases published

Packages

 
 
 

Contributors