Class 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 Detail

      • CMSEnvelopedDataGenerator

        public CMSEnvelopedDataGenerator()
        base constructor
    • Method Detail

      • 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