Top Fields Constructors Methods
org.bouncycastle.cms.jcajce

public abstract Class JceKeyTransRecipient

extends Object
implements KeyTransRecipient
Class Inheritance
All Implemented Interfaces
org.bouncycastle.cms.KeyTransRecipient, org.bouncycastle.cms.Recipient
Known Direct Subclasses
org.bouncycastle.cms.jcajce.JceKeyTransAuthenticatedRecipient, org.bouncycastle.cms.jcajce.JceKeyTransAuthEnvelopedRecipient, org.bouncycastle.cms.jcajce.JceKeyTransEnvelopedRecipient
Imports
java.security.Key, .KeyFactory, .PrivateKey, .Provider, .PublicKey, java.security.spec.X509EncodedKeySpec, java.util.HashMap, .Iterator, .Map, javax.crypto.Cipher, .KeyAgreement, .SecretKey, org.bouncycastle.asn1.ASN1ObjectIdentifier, org.bouncycastle.asn1.cms.CMSObjectIdentifiers, .KEMRecipientInfo, org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers, .Gost2814789EncryptedKey, .GostR3410KeyTransport, .GostR3410TransportParameters, org.bouncycastle.asn1.x509.AlgorithmIdentifier, org.bouncycastle.cms.CMSException, .KeyTransRecipient, org.bouncycastle.jcajce.spec.GOST28147WrapParameterSpec, .UserKeyingMaterialSpec, org.bouncycastle.operator.OperatorException, org.bouncycastle.operator.jcajce.JceAsymmetricKeyUnwrapper, org.bouncycastle.util.Arrays

Field Summary

Modifier and TypeField and Description
protected EnvelopedDataHelper
protected Map<K, V>
protected EnvelopedDataHelper
private PrivateKey
protected boolean
protected boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected Key
extractSecretKey(AlgorithmIdentifier keyEncryptionAlgorithm, AlgorithmIdentifier encryptedKeyAlgorithm, byte[] encryptedEncryptionKey)

public JceKeyTransRecipient

Returns:

the current Recipient.
setAlgorithmMapping
(ASN1ObjectIdentifier
OID of algorithm in recipient.
algorithm
,
String
JCE algorithm name to use.
algorithmName
)

Internally algorithm ids are converted into cipher names using a lookup table.

public JceKeyTransRecipient

Returns:

this recipient.
setContentProvider
(Provider
the provider to use.
provider
)

Set the provider to use for content processing.

public JceKeyTransRecipient

Returns:

this recipient.
setContentProvider
(String
the name of the provider to use.
providerName
)

Set the provider to use for content processing.

public JceKeyTransRecipient

Returns:

this recipient.
setKeySizeValidation
(boolean
true if unwrapped key's should be validated against the content encryption algorithm, false otherwise.
doValidate
)

Set validation of retrieved key sizes against the algorithm parameters for the encrypted key where possible - default is off.

public JceKeyTransRecipient

Returns:

this recipient.
setMustProduceEncodableUnwrappedKey
(boolean
true if getEncoded() should return key bytes, false if not necessary.
unwrappedKeyMustBeEncodable
)

Flag that unwrapping must produce a key that will return a meaningful value from a call to Key.getEncoded().

public JceKeyTransRecipient

Returns:

this recipient.
setProvider
(Provider
provider to use.
provider
)

Set the provider to use for key recovery and content processing.

public JceKeyTransRecipient

Returns:

this recipient.
setProvider
(String
the name of the provider to use.
providerName
)

Set the provider to use for key recovery and content processing.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contentHelperback to summary
protected EnvelopedDataHelper contentHelper
extraMappingsback to summary
protected Map<K, V> extraMappings
helperback to summary
protected EnvelopedDataHelper helper
recipientKeyback to summary
private PrivateKey recipientKey
unwrappedKeyMustBeEncodableback to summary
protected boolean unwrappedKeyMustBeEncodable
validateKeySizeback to summary
protected boolean validateKeySize

Constructor Detail

JceKeyTransRecipientback to summary
public JceKeyTransRecipient(PrivateKey recipientKey)

Method Detail

extractSecretKeyback to summary
protected Key extractSecretKey(AlgorithmIdentifier keyEncryptionAlgorithm, AlgorithmIdentifier encryptedKeyAlgorithm, byte[] encryptedEncryptionKey) throws CMSException
setAlgorithmMappingback to summary
public JceKeyTransRecipient setAlgorithmMapping(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:ASN1ObjectIdentifier

OID of algorithm in recipient.

algorithmName:String

JCE algorithm name to use.

Returns:JceKeyTransRecipient

the current Recipient.

setContentProviderback to summary
public JceKeyTransRecipient setContentProvider(Provider provider)

Set the provider to use for content processing. If providerName is null a "no provider" search will be used to satisfy getInstance calls.

Parameters
provider:Provider

the provider to use.

Returns:JceKeyTransRecipient

this recipient.

setContentProviderback to summary
public JceKeyTransRecipient setContentProvider(String providerName)

Set the provider to use for content processing. If providerName is null a "no provider" search will be used to satisfy getInstance calls.

Parameters
providerName:String

the name of the provider to use.

Returns:JceKeyTransRecipient

this recipient.

setKeySizeValidationback to summary
public JceKeyTransRecipient setKeySizeValidation(boolean doValidate)

Set validation of retrieved key sizes against the algorithm parameters for the encrypted key where possible - default is off.

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.

Parameters
doValidate:boolean

true if unwrapped key's should be validated against the content encryption algorithm, false otherwise.

Returns:JceKeyTransRecipient

this recipient.

setMustProduceEncodableUnwrappedKeyback to summary
public JceKeyTransRecipient 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 decrypting the content. Default value: false.

Parameters
unwrappedKeyMustBeEncodable:boolean

true if getEncoded() should return key bytes, false if not necessary.

Returns:JceKeyTransRecipient

this recipient.

setProviderback to summary
public JceKeyTransRecipient setProvider(Provider provider)

Set the provider to use for key recovery and content processing.

Parameters
provider:Provider

provider to use.

Returns:JceKeyTransRecipient

this recipient.

setProviderback to summary
public JceKeyTransRecipient setProvider(String providerName)

Set the provider to use for key recovery and content processing.

Parameters
providerName:String

the name of the provider to use.

Returns:JceKeyTransRecipient

this recipient.