public class RSAEncrypt extends Object
| 构造器和说明 |
|---|
RSAEncrypt() |
| 限定符和类型 | 方法和说明 |
|---|---|
static RSAPrivateKey |
getPrivateKey(String privateKeyStr)
从字符串中加载私钥
|
static RSAPublicKey |
getPublicKey(String publicKeyStr)
从字符串中加载公钥
|
static byte[] |
privateDecrypt(RSAPrivateKey privateKey,
byte[] cipherData)
私钥解密过程
|
static byte[] |
privateEncrypt(RSAPrivateKey privateKey,
String plainTextData)
私钥加密过程
|
static byte[] |
publicDecrypt(RSAPublicKey publicKey,
byte[] cipherData)
公钥解密过程
|
static byte[] |
publicEncrypt(RSAPublicKey publicKey,
String plainTextData)
公钥加密
|
static byte[] |
sign(byte[] data,
RSAPrivateKey privateKey)
rsa签名
|
static boolean |
verify(byte[] content,
byte[] sign,
RSAPublicKey publicKey)
rsa验签
|
public static RSAPublicKey getPublicKey(String publicKeyStr)
publicKeyStr - 公钥字符串LeonaRuntimeExceptionpublic static RSAPrivateKey getPrivateKey(String privateKeyStr)
privateKeyStr - 私钥数据字符串LeonaRuntimeExceptionpublic static byte[] publicEncrypt(RSAPublicKey publicKey, String plainTextData)
publicKey - 公钥plainTextData - 明文数据LeonaRuntimeException - 加密异常public static byte[] privateEncrypt(RSAPrivateKey privateKey, String plainTextData) throws LeonaRuntimeException
privateKey - 私钥plainTextData - 明文数据LeonaRuntimeException - 加密过程中的异常信息public static byte[] privateDecrypt(RSAPrivateKey privateKey, byte[] cipherData) throws LeonaRuntimeException
privateKey - 私钥cipherData - 密文数据LeonaRuntimeException - 解密过程中的异常信息public static byte[] publicDecrypt(RSAPublicKey publicKey, byte[] cipherData) throws LeonaRuntimeException
publicKey - 公钥cipherData - 密文数据LeonaRuntimeException - 解密过程中的异常信息public static byte[] sign(byte[] data,
RSAPrivateKey privateKey)
throws LeonaRuntimeException
data - 原始数据privateKey - 私钥LeonaRuntimeException - RSA签名异常public static boolean verify(byte[] content,
byte[] sign,
RSAPublicKey publicKey)
throws LeonaRuntimeException
content - 数据sign - 数据签名publicKey - 公钥LeonaRuntimeException - 验签异常Copyright © 2020. All rights reserved.