Package | Description |
---|---|
org.dromara.hutool.crypto.asymmetric |
非对称加密的实现,包括RSA等
|
org.dromara.hutool.crypto.bc |
BouncyCastle库相关工具封装
|
org.dromara.hutool.crypto.digest |
摘要加密算法实现,入口为DigestUtil
|
org.dromara.hutool.crypto.digest.mac |
MAC,全称为“Message Authentication Code”,中文名“消息鉴别码”。
|
Modifier and Type | Method and Description |
---|---|
byte[] |
SM2.decrypt(byte[] data)
使用私钥解密
|
byte[] |
SM2.decrypt(byte[] data,
org.bouncycastle.crypto.CipherParameters privateKeyParameters)
解密
|
byte[] |
SM2.decrypt(byte[] data,
KeyType keyType)
解密
|
byte[] |
SM2.encrypt(byte[] data)
使用公钥加密,SM2非对称加密的结果由C1,C3,C2三部分组成,其中:
C1 生成随机数的计算出的椭圆曲线点
C3 SM3的摘要值
C2 密文数据
|
byte[] |
SM2.encrypt(byte[] data,
org.bouncycastle.crypto.CipherParameters pubKeyParameters)
加密,SM2非对称加密的结果由C1,C2,C3三部分组成,其中:
C1 生成随机数的计算出的椭圆曲线点
C2 密文数据
C3 SM3的摘要值
|
byte[] |
SM2.encrypt(byte[] data,
KeyType keyType)
加密,SM2非对称加密的结果由C1,C3,C2三部分组成,其中:
C1 生成随机数的计算出的椭圆曲线点
C3 SM3的摘要值
C2 密文数据
|
Modifier and Type | Method and Description |
---|---|
static org.bouncycastle.asn1.pkcs.PrivateKeyInfo |
OpensslKeyUtil.decrypt(org.bouncycastle.pkcs.PKCS8EncryptedPrivateKeyInfo pkcs8Info,
char[] password)
解密
PKCS8EncryptedPrivateKeyInfo 为PrivateKeyInfo |
static KeyPair |
OpensslKeyUtil.getKeyPair(org.bouncycastle.openssl.PEMKeyPair keyPair)
转换
PEMKeyPair 为KeyPair |
static PrivateKey |
OpensslKeyUtil.getPrivateKey(org.bouncycastle.asn1.pkcs.PrivateKeyInfo privateKeyInfo)
转换
PrivateKeyInfo 为PrivateKey |
static PublicKey |
OpensslKeyUtil.getPublicKey(org.bouncycastle.asn1.x509.SubjectPublicKeyInfo publicKeyInfo)
转换
SubjectPublicKeyInfo 为PublicKey |
Modifier and Type | Method and Description |
---|---|
byte[] |
Digester.digest(File file)
生成文件摘要
使用默认缓存大小,见 NioUtil.DEFAULT_BUFFER_SIZE |
Modifier and Type | Method and Description |
---|---|
byte[] |
Mac.digest(File file)
生成文件摘要
使用默认缓存大小,见 NioUtil.DEFAULT_BUFFER_SIZE |
Copyright © 2025. All rights reserved.