public abstract class JceKeyTransRecipient extends Object implements KeyTransRecipient
Modifier and Type | Field and Description |
---|---|
protected EnvelopedDataHelper |
contentHelper |
protected Map |
extraMappings |
protected EnvelopedDataHelper |
helper |
protected boolean |
unwrappedKeyMustBeEncodable |
protected boolean |
validateKeySize |
Constructor and Description |
---|
JceKeyTransRecipient(PrivateKey recipientKey) |
Modifier and Type | Method and Description |
---|---|
protected Key |
extractSecretKey(AlgorithmIdentifier keyEncryptionAlgorithm,
AlgorithmIdentifier encryptedKeyAlgorithm,
byte[] encryptedEncryptionKey) |
JceKeyTransRecipient |
setAlgorithmMapping(ASN1ObjectIdentifier algorithm,
String algorithmName)
Internally algorithm ids are converted into cipher names using a lookup table.
|
JceKeyTransRecipient |
setContentProvider(Provider provider)
Set the provider to use for content processing.
|
JceKeyTransRecipient |
setContentProvider(String providerName)
Set the provider to use for content processing.
|
JceKeyTransRecipient |
setKeySizeValidation(boolean doValidate)
Set validation of retrieved key sizes against the algorithm parameters for the encrypted key where possible - default is off.
|
JceKeyTransRecipient |
setMustProduceEncodableUnwrappedKey(boolean unwrappedKeyMustBeEncodable)
Flag that unwrapping must produce a key that will return a meaningful value from a call to Key.getEncoded().
|
JceKeyTransRecipient |
setProvider(Provider provider)
Set the provider to use for key recovery and content processing.
|
JceKeyTransRecipient |
setProvider(String providerName)
Set the provider to use for key recovery and content processing.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getRecipientOperator
protected EnvelopedDataHelper helper
protected EnvelopedDataHelper contentHelper
protected Map extraMappings
protected boolean validateKeySize
protected boolean unwrappedKeyMustBeEncodable
public JceKeyTransRecipient(PrivateKey recipientKey)
public JceKeyTransRecipient setProvider(Provider provider)
provider
- provider to use.public JceKeyTransRecipient setProvider(String providerName)
providerName
- the name of the provider to use.public JceKeyTransRecipient setAlgorithmMapping(ASN1ObjectIdentifier algorithm, String algorithmName)
For example:
unwrapper.setAlgorithmMapping(PKCSObjectIdentifiers.rsaEncryption, "RSA");
algorithm
- OID of algorithm in recipient.algorithmName
- JCE algorithm name to use.public JceKeyTransRecipient setContentProvider(Provider provider)
provider
- the provider to use.public JceKeyTransRecipient setMustProduceEncodableUnwrappedKey(boolean unwrappedKeyMustBeEncodable)
unwrappedKeyMustBeEncodable
- true if getEncoded() should return key bytes, false if not necessary.public JceKeyTransRecipient setContentProvider(String providerName)
providerName
- the name of the provider to use.public JceKeyTransRecipient setKeySizeValidation(boolean doValidate)
This setting will not have any affect if the encryption algorithm in the recipient does not specify a particular key size, or if the unwrapper is a HSM and the byte encoding of the unwrapped secret key is not available.
doValidate
- true if unwrapped key's should be validated against the content encryption algorithm, false otherwise.protected Key extractSecretKey(AlgorithmIdentifier keyEncryptionAlgorithm, AlgorithmIdentifier encryptedKeyAlgorithm, byte[] encryptedEncryptionKey) throws CMSException
CMSException
Copyright © 2021 BouncyCastle.org. All rights reserved.