public final class RSAKit extends Object
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
decrypt(byte[] data,
Key key)
数据解密
|
static byte[] |
decryptByPrivateKey(byte[] data)
私钥解密
|
static byte[] |
decryptByPrivateKey(byte[] data,
byte[] key)
私钥解密
|
static byte[] |
decryptByPublicKey(byte[] data)
公钥解密
|
static byte[] |
decryptByPublicKey(byte[] data,
byte[] key)
公钥解密
|
static byte[] |
encrypt(byte[] data,
Key key)
数据加密
|
static byte[] |
encryptByPrivateKey(byte[] data)
私钥加密
|
static byte[] |
encryptByPrivateKey(byte[] data,
byte[] key)
私钥加密
|
static byte[] |
encryptByPublicKey(byte[] data)
公钥加密
|
static byte[] |
encryptByPublicKey(byte[] data,
byte[] key)
公钥加密
|
static Key |
getPrivateKey()
取得私钥
|
static PrivateKey |
getPrivateKey(String base64EncodedKey)
从以Base64编码的key中获取私钥
|
static byte[] |
getPrivateKeyByte()
取得私钥
|
static Key |
getPublicKey()
取得公钥
|
static PublicKey |
getPublicKey(String base64EncodedKey)
从以Base64编码的key中获取公钥
|
static byte[] |
getPublicKeyByte()
取得公钥
|
static void |
init()
初始化密钥
|
static void |
init(String seed)
初始化密钥
|
public static byte[] encrypt(byte[] data,
Key key)
throws Exception
data - key - Exceptionpublic static byte[] decrypt(byte[] data,
Key key)
throws Exception
data - key - Exceptionpublic static void init(String seed) throws Exception
seed - 种子Exception - 异常public static Key getPrivateKey() throws Exception
Exception - 异常public static byte[] getPrivateKeyByte()
throws Exception
Exception - 异常public static Key getPublicKey() throws Exception
Exception - 异常public static byte[] getPublicKeyByte()
throws Exception
Exception - 异常public static PublicKey getPublicKey(String base64EncodedKey) throws Exception
base64EncodedKey - Exceptionpublic static PrivateKey getPrivateKey(String base64EncodedKey) throws Exception
base64EncodedKey - Exceptionpublic static byte[] encryptByPublicKey(byte[] data,
byte[] key)
throws Exception
data - 待加密数据key - 公钥Exception - 异常public static byte[] encryptByPublicKey(byte[] data)
throws Exception
data - 待加密数据Exception - 异常public static byte[] encryptByPrivateKey(byte[] data,
byte[] key)
throws Exception
data - 待加密数据key - 私钥Exception - 异常public static byte[] encryptByPrivateKey(byte[] data)
throws Exception
data - 待加密数据Exception - 异常public static byte[] decryptByPublicKey(byte[] data,
byte[] key)
throws Exception
data - 待解密数据key - 公钥Exception - 异常public static byte[] decryptByPublicKey(byte[] data)
throws Exception
data - 待解密数据Exception - 异常public static byte[] decryptByPrivateKey(byte[] data,
byte[] key)
throws Exception
data - 待解密数据key - 私钥Exception - 异常Copyright © 2021. All rights reserved.