public class

CMSEnvelopedGenerator

extends Object
java.lang.Object
   ↳ org.bouncycastle.cms.CMSEnvelopedGenerator
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

General class for generating a CMS enveloped-data message.

Summary

Constants
String CAST5_CBC
String IDEA_CBC
Fields
public static final String AES128_CBC
public static final String AES128_WRAP
public static final String AES192_CBC
public static final String AES192_WRAP
public static final String AES256_CBC
public static final String AES256_WRAP
public static final String CAMELLIA128_CBC
public static final String CAMELLIA128_WRAP
public static final String CAMELLIA192_CBC
public static final String CAMELLIA192_WRAP
public static final String CAMELLIA256_CBC
public static final String CAMELLIA256_WRAP
public static final String DES_EDE3_CBC
public static final String DES_EDE3_WRAP
public static final String ECDH_SHA1KDF
public static final String ECMQV_SHA1KDF
public static final String RC2_CBC
public static final String SEED_CBC
public static final String SEED_WRAP
protected CMSAttributeTableGenerator unprotectedAttributeGenerator
Public Constructors
CMSEnvelopedGenerator()
base constructor
CMSEnvelopedGenerator(SecureRandom rand)
constructor allowing specific source of randomness
Public Methods
void addKEKRecipient(SecretKey key, byte[] keyIdentifier)
This method is deprecated. use the addRecipientGenerator and JceKEKRecipientInfoGenerator
void addKEKRecipient(SecretKey key, KEKIdentifier kekIdentifier)
This method is deprecated. use the addRecipientGenerator and JceKEKRecipientInfoGenerator
void addKeyAgreementRecipient(String agreementAlgorithm, PrivateKey senderPrivateKey, PublicKey senderPublicKey, X509Certificate recipientCert, String cekWrapAlgorithm, String provider)
This method is deprecated. use the addRecipientGenerator and JceKeyAgreeRecipientInfoGenerator
void addKeyAgreementRecipient(String agreementAlgorithm, PrivateKey senderPrivateKey, PublicKey senderPublicKey, X509Certificate recipientCert, String cekWrapAlgorithm, Provider provider)
This method is deprecated. use the addRecipientGenerator and JceKeyAgreeRecipientInfoGenerator
void addKeyAgreementRecipients(String agreementAlgorithm, PrivateKey senderPrivateKey, PublicKey senderPublicKey, Collection recipientCerts, String cekWrapAlgorithm, String provider)
This method is deprecated. use the addRecipientGenerator and JceKeyAgreeRecipientInfoGenerator
void addKeyAgreementRecipients(String agreementAlgorithm, PrivateKey senderPrivateKey, PublicKey senderPublicKey, Collection recipientCerts, String cekWrapAlgorithm, Provider provider)
This method is deprecated. use the addRecipientGenerator and JceKeyAgreeRecipientInfoGenerator
void addKeyTransRecipient(PublicKey key, byte[] subKeyId)
This method is deprecated. use the addRecipientGenerator and JceKeyTransRecipientInfoGenerator
void addKeyTransRecipient(X509Certificate cert)
This method is deprecated. use the addRecipientGenerator and JceKeyTransRecipientInfoGenerator
void addPasswordRecipient(CMSPBEKey pbeKey, String kekAlgorithmOid)
This method is deprecated. use addRecipientGenerator and JcePasswordRecipientInfoGenerator
void addRecipientInfoGenerator(RecipientInfoGenerator recipientGenerator)
Add a generator to produce the recipient info required.
void setUnprotectedAttributeGenerator(CMSAttributeTableGenerator unprotectedAttributeGenerator)
Protected Methods
AlgorithmParameters generateParameters(String encryptionOID, SecretKey encKey, Provider encProvider)
AlgorithmIdentifier getAlgorithmIdentifier(String encryptionOID, AlgorithmParameters params)
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String CAST5_CBC

Constant Value: "1.2.840.113533.7.66.10"

public static final String IDEA_CBC

Constant Value: "1.3.6.1.4.1.188.7.1.1.2"

Fields

public static final String AES128_CBC

public static final String AES128_WRAP

public static final String AES192_CBC

public static final String AES192_WRAP

public static final String AES256_CBC

public static final String AES256_WRAP

public static final String CAMELLIA128_CBC

public static final String CAMELLIA128_WRAP

public static final String CAMELLIA192_CBC

public static final String CAMELLIA192_WRAP

public static final String CAMELLIA256_CBC

public static final String CAMELLIA256_WRAP

public static final String DES_EDE3_CBC

public static final String DES_EDE3_WRAP

public static final String ECDH_SHA1KDF

public static final String ECMQV_SHA1KDF

public static final String RC2_CBC

public static final String SEED_CBC

public static final String SEED_WRAP

protected CMSAttributeTableGenerator unprotectedAttributeGenerator

Public Constructors

public CMSEnvelopedGenerator ()

base constructor

public CMSEnvelopedGenerator (SecureRandom rand)

constructor allowing specific source of randomness

Parameters
rand instance of SecureRandom to use

Public Methods

public void addKEKRecipient (SecretKey key, byte[] keyIdentifier)

This method is deprecated.
use the addRecipientGenerator and JceKEKRecipientInfoGenerator

add a KEK recipient.

Parameters
key the secret key to use for wrapping
keyIdentifier the byte string that identifies the key

public void addKEKRecipient (SecretKey key, KEKIdentifier kekIdentifier)

This method is deprecated.
use the addRecipientGenerator and JceKEKRecipientInfoGenerator

add a KEK recipient.

Parameters
key the secret key to use for wrapping
kekIdentifier a KEKIdentifier structure (identifies the key)

public void addKeyAgreementRecipient (String agreementAlgorithm, PrivateKey senderPrivateKey, PublicKey senderPublicKey, X509Certificate recipientCert, String cekWrapAlgorithm, String provider)

This method is deprecated.
use the addRecipientGenerator and JceKeyAgreeRecipientInfoGenerator

Add a key agreement based recipient.

Parameters
agreementAlgorithm key agreement algorithm to use.
senderPrivateKey private key to initialise sender side of agreement with.
senderPublicKey sender public key to include with message.
recipientCert recipient's public key certificate.
cekWrapAlgorithm OID for key wrapping algorithm to use.
provider provider to use for the agreement calculation.
Throws
NoSuchProviderException if the specified provider cannot be found
NoSuchAlgorithmException if the algorithm requested cannot be found
InvalidKeyException if the keys are inappropriate for the algorithm specified

public void addKeyAgreementRecipient (String agreementAlgorithm, PrivateKey senderPrivateKey, PublicKey senderPublicKey, X509Certificate recipientCert, String cekWrapAlgorithm, Provider provider)

This method is deprecated.
use the addRecipientGenerator and JceKeyAgreeRecipientInfoGenerator

Add a key agreement based recipient.

Parameters
agreementAlgorithm key agreement algorithm to use.
senderPrivateKey private key to initialise sender side of agreement with.
senderPublicKey sender public key to include with message.
recipientCert recipient's public key certificate.
cekWrapAlgorithm OID for key wrapping algorithm to use.
provider provider to use for the agreement calculation.
Throws
NoSuchAlgorithmException if the algorithm requested cannot be found
InvalidKeyException if the keys are inappropriate for the algorithm specified

public void addKeyAgreementRecipients (String agreementAlgorithm, PrivateKey senderPrivateKey, PublicKey senderPublicKey, Collection recipientCerts, String cekWrapAlgorithm, String provider)

This method is deprecated.
use the addRecipientGenerator and JceKeyAgreeRecipientInfoGenerator

Add multiple key agreement based recipients (sharing a single KeyAgreeRecipientInfo structure).

Parameters
agreementAlgorithm key agreement algorithm to use.
senderPrivateKey private key to initialise sender side of agreement with.
senderPublicKey sender public key to include with message.
recipientCerts recipients' public key certificates.
cekWrapAlgorithm OID for key wrapping algorithm to use.
provider provider to use for the agreement calculation.
Throws
NoSuchAlgorithmException if the algorithm requested cannot be found
InvalidKeyException if the keys are inappropriate for the algorithm specified
NoSuchProviderException

public void addKeyAgreementRecipients (String agreementAlgorithm, PrivateKey senderPrivateKey, PublicKey senderPublicKey, Collection recipientCerts, String cekWrapAlgorithm, Provider provider)

This method is deprecated.
use the addRecipientGenerator and JceKeyAgreeRecipientInfoGenerator

Add multiple key agreement based recipients (sharing a single KeyAgreeRecipientInfo structure).

Parameters
agreementAlgorithm key agreement algorithm to use.
senderPrivateKey private key to initialise sender side of agreement with.
senderPublicKey sender public key to include with message.
recipientCerts recipients' public key certificates.
cekWrapAlgorithm OID for key wrapping algorithm to use.
provider provider to use for the agreement calculation.
Throws
NoSuchAlgorithmException if the algorithm requested cannot be found
InvalidKeyException if the keys are inappropriate for the algorithm specified

public void addKeyTransRecipient (PublicKey key, byte[] subKeyId)

This method is deprecated.
use the addRecipientGenerator and JceKeyTransRecipientInfoGenerator

add a recipient

Parameters
key the public key used by the recipient
subKeyId the identifier for the recipient's public key
Throws
IllegalArgumentException if there is a problem with the key

public void addKeyTransRecipient (X509Certificate cert)

This method is deprecated.
use the addRecipientGenerator and JceKeyTransRecipientInfoGenerator

add a recipient.

Parameters
cert recipient's public key certificate
Throws
IllegalArgumentException if there is a problem with the certificate

public void addPasswordRecipient (CMSPBEKey pbeKey, String kekAlgorithmOid)

This method is deprecated.
use addRecipientGenerator and JcePasswordRecipientInfoGenerator

Parameters
pbeKey PBE key
kekAlgorithmOid key encryption algorithm to use.

public void addRecipientInfoGenerator (RecipientInfoGenerator recipientGenerator)

Add a generator to produce the recipient info required.

Parameters
recipientGenerator a generator of a recipient info object.

public void setUnprotectedAttributeGenerator (CMSAttributeTableGenerator unprotectedAttributeGenerator)

Protected Methods

protected AlgorithmParameters generateParameters (String encryptionOID, SecretKey encKey, Provider encProvider)

Throws
CMSException

protected AlgorithmIdentifier getAlgorithmIdentifier (String encryptionOID, AlgorithmParameters params)

Throws
IOException