Bouncy Castle Cryptography 1.27

org.bouncycastle.cms
Class CMSEnvelopedDataGenerator

java.lang.Object
  |
  +--org.bouncycastle.cms.CMSEnvelopedDataGenerator

public class CMSEnvelopedDataGenerator
extends java.lang.Object

General class for generating a pkcs7-mime message. A simple example of usage.

      CMSEnvelopedDataGenerator  fact = new CMSEnvelopedDataGenerator();

      fact.addKeyTransRecipient(cert);

      CMSEnvelopedData         data = fact.generate(content, algorithm, "BC");
 


Field Summary
static java.lang.String AES128_CBC
           
static java.lang.String AES192_CBC
           
static java.lang.String AES256_CBC
           
static java.lang.String CAST5_CBC
           
static java.lang.String DES_EDE3_CBC
           
static java.lang.String IDEA_CBC
           
static java.lang.String RC2_CBC
           
 
Constructor Summary
CMSEnvelopedDataGenerator()
          base constructor
 
Method Summary
 void addKEKRecipient(javax.crypto.SecretKey key, byte[] keyIdentifier)
          add a KEK recipient.
 void addKeyTransRecipient(java.security.PublicKey key, byte[] subKeyId)
          add a recipient
 void addKeyTransRecipient(java.security.cert.X509Certificate cert)
          add a recipient.
 CMSEnvelopedData generate(CMSProcessable content, java.lang.String encryptionOID, int keySize, java.lang.String provider)
          generate an enveloped object that contains an CMS Enveloped Data object using the given provider.
 CMSEnvelopedData generate(CMSProcessable content, java.lang.String encryptionOID, java.lang.String provider)
          generate an enveloped object that contains an CMS Enveloped Data object using the given provider.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DES_EDE3_CBC

public static final java.lang.String DES_EDE3_CBC

RC2_CBC

public static final java.lang.String RC2_CBC

IDEA_CBC

public static final java.lang.String IDEA_CBC

CAST5_CBC

public static final java.lang.String CAST5_CBC

AES128_CBC

public static final java.lang.String AES128_CBC

AES192_CBC

public static final java.lang.String AES192_CBC

AES256_CBC

public static final java.lang.String AES256_CBC
Constructor Detail

CMSEnvelopedDataGenerator

public CMSEnvelopedDataGenerator()
base constructor
Method Detail

addKeyTransRecipient

public void addKeyTransRecipient(java.security.cert.X509Certificate cert)
                          throws java.lang.IllegalArgumentException
add a recipient.

addKeyTransRecipient

public void addKeyTransRecipient(java.security.PublicKey key,
                                 byte[] subKeyId)
                          throws java.lang.IllegalArgumentException
add a recipient
Parameters:
key - the public key used by the recipient
subKeyId - the identifier for the recipient's public key

addKEKRecipient

public void addKEKRecipient(javax.crypto.SecretKey key,
                            byte[] keyIdentifier)
add a KEK recipient.

generate

public CMSEnvelopedData generate(CMSProcessable content,
                                 java.lang.String encryptionOID,
                                 java.lang.String provider)
                          throws java.security.NoSuchAlgorithmException,
                                 java.security.NoSuchProviderException,
                                 CMSException
generate an enveloped object that contains an CMS Enveloped Data object using the given provider.

generate

public CMSEnvelopedData generate(CMSProcessable content,
                                 java.lang.String encryptionOID,
                                 int keySize,
                                 java.lang.String provider)
                          throws java.security.NoSuchAlgorithmException,
                                 java.security.NoSuchProviderException,
                                 CMSException
generate an enveloped object that contains an CMS Enveloped Data object using the given provider.

Bouncy Castle Cryptography 1.27