public class

CMSEnvelopedData

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

Class Overview

containing class for an CMS Enveloped Data object

Example of use - assuming the first recipient matches the private key we have.

      CMSEnvelopedData     ed = new CMSEnvelopedData(inputStream);

      RecipientInformationStore  recipients = ed.getRecipientInfos();

      Collection  c = recipients.getRecipients();
      Iterator    it = c.iterator();

      if (it.hasNext())
      {
          RecipientInformation   recipient = (RecipientInformation)it.next();

          byte[] recData = recipient.getContent(new JceKeyTransEnvelopedRecipient(privateKey).setProvider("BC"));

          processData(recData);
      }
  

Summary

Public Constructors
CMSEnvelopedData(byte[] envelopedData)
CMSEnvelopedData(InputStream envelopedData)
CMSEnvelopedData(ContentInfo contentInfo)
Public Methods
ContentInfo getContentInfo()
return the ContentInfo
byte[] getEncoded()
return the ASN.1 encoded representation of this object.
String getEncryptionAlgOID()
return the object identifier for the content encryption algorithm.
byte[] getEncryptionAlgParams()
return the ASN.1 encoded encryption algorithm parameters, or null if there aren't any.
AlgorithmParameters getEncryptionAlgorithmParameters(String provider)
Return an AlgorithmParameters object giving the encryption parameters used to encrypt the message content.
AlgorithmParameters getEncryptionAlgorithmParameters(Provider provider)
Return an AlgorithmParameters object giving the encryption parameters used to encrypt the message content.
RecipientInformationStore getRecipientInfos()
return a store of the intended recipients for this message
AttributeTable getUnprotectedAttributes()
return a table of the unprotected attributes indexed by the OID of the attribute.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public CMSEnvelopedData (byte[] envelopedData)

Throws
CMSException

public CMSEnvelopedData (InputStream envelopedData)

Throws
CMSException

public CMSEnvelopedData (ContentInfo contentInfo)

Public Methods

public ContentInfo getContentInfo ()

return the ContentInfo

public byte[] getEncoded ()

return the ASN.1 encoded representation of this object.

Throws
IOException

public String getEncryptionAlgOID ()

return the object identifier for the content encryption algorithm.

public byte[] getEncryptionAlgParams ()

return the ASN.1 encoded encryption algorithm parameters, or null if there aren't any.

public AlgorithmParameters getEncryptionAlgorithmParameters (String provider)

Return an AlgorithmParameters object giving the encryption parameters used to encrypt the message content.

Parameters
provider the provider to generate the parameters for.
Returns
  • the parameters object, null if there is not one.
Throws
CMSException if the algorithm cannot be found, or the parameters can't be parsed.
NoSuchProviderException if the provider cannot be found.

public AlgorithmParameters getEncryptionAlgorithmParameters (Provider provider)

Return an AlgorithmParameters object giving the encryption parameters used to encrypt the message content.

Parameters
provider the provider to generate the parameters for.
Returns
  • the parameters object, null if there is not one.
Throws
CMSException if the algorithm cannot be found, or the parameters can't be parsed.

public RecipientInformationStore getRecipientInfos ()

return a store of the intended recipients for this message

public AttributeTable getUnprotectedAttributes ()

return a table of the unprotected attributes indexed by the OID of the attribute.