Package org.bouncycastle.operator.jcajce
Class JceAsymmetricKeyWrapper
- java.lang.Object
-
- org.bouncycastle.operator.AsymmetricKeyWrapper
-
- org.bouncycastle.operator.jcajce.JceAsymmetricKeyWrapper
-
- All Implemented Interfaces:
KeyWrapper
public class JceAsymmetricKeyWrapper extends AsymmetricKeyWrapper
-
-
Constructor Summary
Constructors Constructor Description JceAsymmetricKeyWrapper(AlgorithmParameters algorithmParams, PublicKey publicKey)
Create a wrapper, overriding the algorithm type that is stored in the public key.JceAsymmetricKeyWrapper(X509Certificate certificate)
JceAsymmetricKeyWrapper(PublicKey publicKey)
JceAsymmetricKeyWrapper(AlgorithmParameterSpec algorithmParameterSpec, PublicKey publicKey)
Create a wrapper, overriding the algorithm type that is stored in the public key.JceAsymmetricKeyWrapper(org.bouncycastle.asn1.x509.AlgorithmIdentifier algorithmIdentifier, PublicKey publicKey)
Create a wrapper, overriding the algorithm type that is stored in the public key.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
generateWrappedKey(GenericKey encryptionKey)
JceAsymmetricKeyWrapper
setAlgorithmMapping(org.bouncycastle.asn1.ASN1ObjectIdentifier algorithm, String algorithmName)
Internally algorithm ids are converted into cipher names using a lookup table.JceAsymmetricKeyWrapper
setProvider(String providerName)
JceAsymmetricKeyWrapper
setProvider(Provider provider)
JceAsymmetricKeyWrapper
setSecureRandom(SecureRandom random)
-
Methods inherited from class org.bouncycastle.operator.AsymmetricKeyWrapper
getAlgorithmIdentifier
-
-
-
-
Constructor Detail
-
JceAsymmetricKeyWrapper
public JceAsymmetricKeyWrapper(PublicKey publicKey)
-
JceAsymmetricKeyWrapper
public JceAsymmetricKeyWrapper(X509Certificate certificate)
-
JceAsymmetricKeyWrapper
public JceAsymmetricKeyWrapper(org.bouncycastle.asn1.x509.AlgorithmIdentifier algorithmIdentifier, PublicKey publicKey)
Create a wrapper, overriding the algorithm type that is stored in the public key.- Parameters:
algorithmIdentifier
- identifier for encryption algorithm to be used.publicKey
- the public key to be used.
-
JceAsymmetricKeyWrapper
public JceAsymmetricKeyWrapper(AlgorithmParameters algorithmParams, PublicKey publicKey) throws InvalidParameterSpecException
Create a wrapper, overriding the algorithm type that is stored in the public key.- Parameters:
algorithmParams
- algorithm parameters for encryption algorithm to be used.publicKey
- the public key to be used.- Throws:
InvalidParameterSpecException
-
JceAsymmetricKeyWrapper
public JceAsymmetricKeyWrapper(AlgorithmParameterSpec algorithmParameterSpec, PublicKey publicKey)
Create a wrapper, overriding the algorithm type that is stored in the public key.- Parameters:
algorithmParameterSpec
- the parameterSpec for encryption algorithm to be used.publicKey
- the public key to be used.
-
-
Method Detail
-
setProvider
public JceAsymmetricKeyWrapper setProvider(Provider provider)
-
setProvider
public JceAsymmetricKeyWrapper setProvider(String providerName)
-
setSecureRandom
public JceAsymmetricKeyWrapper setSecureRandom(SecureRandom random)
-
setAlgorithmMapping
public JceAsymmetricKeyWrapper setAlgorithmMapping(org.bouncycastle.asn1.ASN1ObjectIdentifier algorithm, String algorithmName)
Internally algorithm ids are converted into cipher names using a lookup table. For some providers the standard lookup table won't work. Use this method to establish a specific mapping from an algorithm identifier to a specific algorithm.For example:
unwrapper.setAlgorithmMapping(PKCSObjectIdentifiers.rsaEncryption, "RSA");
- Parameters:
algorithm
- OID of algorithm in recipient.algorithmName
- JCE algorithm name to use.- Returns:
- the current Wrapper.
-
generateWrappedKey
public byte[] generateWrappedKey(GenericKey encryptionKey) throws OperatorException
- Throws:
OperatorException
-
-