public abstract class RSAEncrypt extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
ENCODING |
static String |
KEY_ALGORITHM |
static String |
SIGNATURE_ALGORITHM |
static String |
X509 |
| Constructor and Description |
|---|
RSAEncrypt() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
decryptByPrivateKey(byte[] bytes,
String privateKey)
RSA解密
|
static byte[] |
encryptByPublicKey(byte[] bytes,
String publicKey)
RSA加密
|
static int |
getByteLength(BigInteger modulus) |
static String |
getKey(String content) |
static PrivateKey |
getPrivateKey(String key)
获取私钥
|
static PublicKey |
getPublicKey(String key)
获取公钥
|
static int |
keySize(RSAKey rsaKey) |
static int |
maxCipherLength(PrivateKey privateKey) |
static int |
maxPlainTextLength(PublicKey publicKey) |
static String |
readSourceKey(String path)
从文件中读取密钥字符串
|
public static final String KEY_ALGORITHM
public static final String ENCODING
public static final String SIGNATURE_ALGORITHM
public static final String X509
public static byte[] encryptByPublicKey(byte[] bytes,
String publicKey)
bytes - 待签名数据原始串publicKey - 公钥public static byte[] decryptByPrivateKey(byte[] bytes,
String privateKey)
bytes - 密文privateKey - 私钥public static int maxCipherLength(PrivateKey privateKey)
public static int maxPlainTextLength(PublicKey publicKey)
public static int getByteLength(BigInteger modulus)
public static int keySize(RSAKey rsaKey)
public static PrivateKey getPrivateKey(String key) throws Exception
key - Exceptionpublic static PublicKey getPublicKey(String key) throws Exception
key - ExceptionCopyright © 2018. All rights reserved.