| 构造器和说明 |
|---|
RSAUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static byte[] |
decrypByPublicKey(byte[] content,
PublicKey publicKey)
公钥解密
|
static byte[] |
decrypByPublicKey(byte[] content,
String publicKeyBase64)
公钥解密
|
static byte[] |
decryptByPrivateKey(byte[] content,
PrivateKey privateKey)
私钥解密
|
static byte[] |
decryptByPrivateKey(byte[] content,
String privateKeyBase64)
私钥解密
|
static String |
decryptToStringByPrivateKey(String base64Content,
String privateKeyBase64)
私钥解密
|
static String |
decryptToStringByPublicKey(String base64Content,
String publicKeyBase64)
公钥解密
|
static byte[] |
encryptByPrivateKey(byte[] content,
PrivateKey privateKey)
私钥加密
|
static byte[] |
encryptByPrivateKey(byte[] content,
String privateKeyBase64)
私钥加密
|
static byte[] |
encryptByPublicKey(byte[] content,
PublicKey publicKey)
公钥加密
|
static byte[] |
encryptByPublicKey(byte[] content,
String publicKeyBase64)
公钥加密
|
static String |
encryptToBase64ByPrivateKey(byte[] content,
PrivateKey privateKey)
私钥加密
|
static String |
encryptToBase64ByPrivateKey(byte[] content,
String privateKeyBase64)
私钥加密
|
static String |
encryptToBase64ByPrivateKey(String content,
String privateKeyBase64)
私钥加密
|
static String |
encryptToBase64ByPublicKey(byte[] content,
PublicKey publicKey)
公钥加密
|
static String |
encryptToBase64ByPublicKey(byte[] content,
String publicKeyBase64)
公钥加密
|
static String |
encryptToBase64ByPublicKey(String content,
String publicKeyBase64)
公钥加密
|
static KeyPair |
getKeyPair(int keysize)
生成密钥对
|
static KeyPair |
getKeyPair2048()
生成key长度为 2048 的秘钥对
|
static String[] |
getKeyPairAsBase64()
生成key长度为 2048 的秘钥对
|
static String[] |
getKeyPairAsBase64(int keysize)
生成密钥对
|
static PrivateKey |
getPrivateKey(String privateKey)
私钥字符串转PrivateKey实例
|
static PublicKey |
getPublicKey(String publicKey)
公钥字符串转PublicKey实例
|
public RSAUtil()
public static KeyPair getKeyPair2048() throws Exception
Exceptionpublic static KeyPair getKeyPair(int keysize) throws Exception
Exceptionpublic static String[] getKeyPairAsBase64() throws Exception
Exceptionpublic static String[] getKeyPairAsBase64(int keysize) throws Exception
Exceptionpublic static PublicKey getPublicKey(String publicKey) throws Exception
publicKey - Exceptionpublic static PrivateKey getPrivateKey(String privateKey) throws Exception
privateKey - Exceptionpublic static byte[] encryptByPublicKey(byte[] content, PublicKey publicKey) throws Exception
content - publicKey - Exceptionpublic static byte[] encryptByPublicKey(byte[] content, String publicKeyBase64) throws Exception
content - publicKeyBase64 - Exceptionpublic static String encryptToBase64ByPublicKey(byte[] content, PublicKey publicKey) throws Exception
content - publicKey - Exceptionpublic static String encryptToBase64ByPublicKey(byte[] content, String publicKeyBase64) throws Exception
content - publicKeyBase64 - Exceptionpublic static String encryptToBase64ByPublicKey(String content, String publicKeyBase64) throws Exception
content - publicKeyBase64 - Exceptionpublic static byte[] encryptByPrivateKey(byte[] content, PrivateKey privateKey) throws Exception
content - privateKey - Exceptionpublic static byte[] encryptByPrivateKey(byte[] content, String privateKeyBase64) throws Exception
content - privateKeyBase64 - Exceptionpublic static String encryptToBase64ByPrivateKey(byte[] content, PrivateKey privateKey) throws Exception
content - privateKey - Exceptionpublic static String encryptToBase64ByPrivateKey(byte[] content, String privateKeyBase64) throws Exception
content - privateKeyBase64 - Exceptionpublic static String encryptToBase64ByPrivateKey(String content, String privateKeyBase64) throws Exception
content - privateKeyBase64 - Exceptionpublic static byte[] decryptByPrivateKey(byte[] content, PrivateKey privateKey) throws Exception
content - privateKey - Exceptionpublic static byte[] decryptByPrivateKey(byte[] content, String privateKeyBase64) throws Exception
content - privateKeyBase64 - Exceptionpublic static String decryptToStringByPrivateKey(String base64Content, String privateKeyBase64) throws Exception
base64Content - privateKeyBase64 - Exceptionpublic static byte[] decrypByPublicKey(byte[] content, PublicKey publicKey) throws Exception
content - publicKey - Exceptionpublic static byte[] decrypByPublicKey(byte[] content, String publicKeyBase64) throws Exception
content - publicKeyBase64 - ExceptionCopyright © 2024. All rights reserved.