public class RsaAlgorithm extends Object
| Constructor and Description |
|---|
RsaAlgorithm() |
| Modifier and Type | Method and Description |
|---|---|
static Blob |
decrypt(Blob keyBits,
Blob encryptedData,
EncryptParams params)
Decrypt the encryptedData using the keyBits according the encrypt params.
|
static EncryptKey |
deriveEncryptKey(Blob keyBits)
Derive a new encrypt key from the given decrypt key value.
|
static Blob |
encrypt(Blob keyBits,
Blob plainData,
EncryptParams params)
Encrypt the plainData using the keyBits according the encrypt params.
|
static DecryptKey |
generateKey(RsaKeyParams params)
Generate a new random decrypt key for RSA based on the given params.
|
public static DecryptKey generateKey(RsaKeyParams params) throws SecurityException
params - The key params with the key size (in bits).SecurityExceptionpublic static EncryptKey deriveEncryptKey(Blob keyBits) throws SecurityException
keyBits - The key value of the decrypt key (PKCS8-encoded private
key).SecurityExceptionpublic static Blob decrypt(Blob keyBits, Blob encryptedData, EncryptParams params) throws SecurityException
keyBits - The key value (PKCS8-encoded private key).encryptedData - The data to decrypt.params - This decrypts according to params.getAlgorithmType().SecurityExceptionpublic static Blob encrypt(Blob keyBits, Blob plainData, EncryptParams params) throws InvalidKeySpecException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException
keyBits - The key value (DER-encoded public key).plainData - The data to encrypt.params - This encrypts according to params.getAlgorithmType().InvalidKeySpecExceptionNoSuchAlgorithmExceptionNoSuchPaddingExceptionInvalidKeyExceptionIllegalBlockSizeExceptionBadPaddingExceptionCopyright © 2019. All rights reserved.