Class CMSEnvelopedDataGenerator

java.lang.Object
org.bouncycastle.cms.CMSEnvelopedGenerator
org.bouncycastle.cms.CMSEnvelopedDataGenerator

public class CMSEnvelopedDataGenerator extends CMSEnvelopedGenerator
General class for generating a CMS enveloped-data message. A simple example of usage.
      CMSTypedData msg     = new CMSProcessableByteArray("Hello World!".getBytes());

      CMSEnvelopedDataGenerator edGen = new CMSEnvelopedDataGenerator();

      edGen.addRecipientInfoGenerator(new JceKeyTransRecipientInfoGenerator(recipientCert).setProvider("BC"));

      CMSEnvelopedData ed = edGen.generate(
                                      msg,
                                      new JceCMSContentEncryptorBuilder(CMSAlgorithm.DES_EDE3_CBC)
                                             .setProvider("BC").build());

  • Constructor Details

    • CMSEnvelopedDataGenerator

      public CMSEnvelopedDataGenerator()
      base constructor
  • Method Details

    • generate

      public CMSEnvelopedData generate(CMSTypedData content, OutputEncryptor contentEncryptor) throws CMSException
      generate an enveloped object that contains an CMS Enveloped Data object using the given provider.
      Parameters:
      content - the content to be encrypted
      contentEncryptor - the symmetric key based encryptor to encrypt the content with.
      Throws:
      CMSException