net.named_data.jndn.encrypt.algo
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 NoSuchAlgorithmException
params
- The key params with the key size (in bits).NoSuchAlgorithmException
public static EncryptKey deriveEncryptKey(Blob keyBits) throws InvalidKeySpecException, DerDecodingException
keyBits
- The key value of the decrypt key (PKCS8-encoded private
key).InvalidKeySpecException
DerDecodingException
public static Blob decrypt(Blob keyBits, Blob encryptedData, EncryptParams params) throws InvalidKeySpecException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException
keyBits
- The key value (PKCS8-encoded private key).encryptedData
- The data to decrypt.params
- This decrypts according to params.getAlgorithmType().InvalidKeySpecException
NoSuchAlgorithmException
NoSuchPaddingException
InvalidKeyException
IllegalBlockSizeException
BadPaddingException
public 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().InvalidKeySpecException
NoSuchAlgorithmException
NoSuchPaddingException
InvalidKeyException
IllegalBlockSizeException
BadPaddingException
Copyright © 2016. All rights reserved.