Package org.bouncycastle.operator.jcajce
Class JceAsymmetricKeyUnwrapper
java.lang.Object
org.bouncycastle.operator.AsymmetricKeyUnwrapper
org.bouncycastle.operator.jcajce.JceAsymmetricKeyUnwrapper
- All Implemented Interfaces:
KeyUnwrapper
-
Constructor Summary
ConstructorDescriptionJceAsymmetricKeyUnwrapper
(org.bouncycastle.asn1.x509.AlgorithmIdentifier algorithmIdentifier, PrivateKey privKey) -
Method Summary
Modifier and TypeMethodDescriptiongenerateUnwrappedKey
(org.bouncycastle.asn1.x509.AlgorithmIdentifier encryptedKeyAlgorithm, byte[] encryptedKey) setAlgorithmMapping
(org.bouncycastle.asn1.ASN1ObjectIdentifier algorithm, String algorithmName) Internally algorithm ids are converted into cipher names using a lookup table.setMustProduceEncodableUnwrappedKey
(boolean unwrappedKeyMustBeEncodable) Flag that unwrapping must produce a key that will return a meaningful value from a call to Key.getEncoded().setProvider
(String providerName) setProvider
(Provider provider) Methods inherited from class org.bouncycastle.operator.AsymmetricKeyUnwrapper
getAlgorithmIdentifier
-
Constructor Details
-
JceAsymmetricKeyUnwrapper
public JceAsymmetricKeyUnwrapper(org.bouncycastle.asn1.x509.AlgorithmIdentifier algorithmIdentifier, PrivateKey privKey)
-
-
Method Details
-
setProvider
-
setProvider
-
setMustProduceEncodableUnwrappedKey
public JceAsymmetricKeyUnwrapper setMustProduceEncodableUnwrappedKey(boolean unwrappedKeyMustBeEncodable) Flag that unwrapping must produce a key that will return a meaningful value from a call to Key.getEncoded(). This is important if you are using a HSM for unwrapping and using a software based provider for with the unwrapped key. Default value: false.- Parameters:
unwrappedKeyMustBeEncodable
- true if getEncoded() should return key bytes, false if not necessary.- Returns:
- this recipient.
-
setAlgorithmMapping
public JceAsymmetricKeyUnwrapper 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 Unwrapper.
-
generateUnwrappedKey
public GenericKey generateUnwrappedKey(org.bouncycastle.asn1.x509.AlgorithmIdentifier encryptedKeyAlgorithm, byte[] encryptedKey) throws OperatorException - Throws:
OperatorException
-