public class RSADigestUtils extends Object
Description: API to append RSA digest numbers
| 限定符和类型 | 类和说明 |
|---|---|
static class |
RSADigestUtils.RSAKeyPair
RSA private key and public key pair class
|
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
DEFAULT_CHARSET |
static String |
ENCRYPT_TYPE |
| 构造器和说明 |
|---|
RSADigestUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
decrypt(String str,
String privateKey)
Encode str with privateKey key. privateKey must be the pair of publicKey that used to encode this str.
|
static String |
encrypt(String str,
String publicKey)
Encode str with public key. publicKey must be the pair of private key that used to decode this str.
|
static RSADigestUtils.RSAKeyPair |
generateKeyPair()
Generate a private/public key pair
private key : decode digest
public key : encode digest
returns a key pair
RSADigestUtils.RSAKeyPair |
public static RSADigestUtils.RSAKeyPair generateKeyPair() throws NoSuchAlgorithmException
RSADigestUtils.RSAKeyPairRSADigestUtils.RSAKeyPairNoSuchAlgorithmExceptionpublic static String encrypt(String str, String publicKey) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException
generateKeyPair()str - publicKey - NoSuchAlgorithmExceptionInvalidKeySpecExceptionNoSuchPaddingExceptionInvalidKeyExceptionIllegalBlockSizeExceptionBadPaddingExceptionpublic static String decrypt(String str, String privateKey) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidKeySpecException, BadPaddingException, IllegalBlockSizeException
generateKeyPair()str - privateKey - NoSuchAlgorithmExceptionNoSuchPaddingExceptionInvalidKeyExceptionInvalidKeySpecExceptionBadPaddingExceptionIllegalBlockSizeExceptionCopyright © 2020. All rights reserved.