Top Description Fields Constructors Methods
org.bouncycastle.cms

public Class CMSEnvelopedData

extends Object
implements Encodable
Class Inheritance
All Implemented Interfaces
org.bouncycastle.util.Encodable
Imports
java.io.IOException, .InputStream, org.bouncycastle.asn1.ASN1Set, org.bouncycastle.asn1.cms.AttributeTable, .ContentInfo, .EncryptedContentInfo, .EnvelopedData, org.bouncycastle.asn1.x509.AlgorithmIdentifier, org.bouncycastle.util.Encodable

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);
     }
 

Field Summary

Modifier and TypeField and Description
pack-priv ContentInfo
private AlgorithmIdentifier
private OriginatorInformation
pack-priv RecipientInformationStore
private ASN1Set

Constructor Summary

AccessConstructor and Description
public
CMSEnvelopedData(byte[] envelopedData)

public
public
CMSEnvelopedData(ContentInfo
the contentInfo containing the CMS EnvelopedData object.
contentInfo
)

Construct a CMSEnvelopedData object from a content info object.

Method Summary

Modifier and TypeMethod and Description
public AlgorithmIdentifier

Returns:

AlgorithmIdentifier representing the content encryption algorithm.
getContentEncryptionAlgorithm
()

Return the content encryption algorithm details for the data in this object.

public byte[]
getEncoded()

Implements org.bouncycastle.util.Encodable.getEncoded.

return the ASN.1 encoded representation of this object.

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 OriginatorInformation

Returns:

OriginatorInformation, null if not present.
getOriginatorInfo
()

Return the originator information associated with this message if present.

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.

public ContentInfo
toASN1Structure()

return the ContentInfo

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contentInfoback to summary
pack-priv ContentInfo contentInfo
encAlgback to summary
private AlgorithmIdentifier encAlg
originatorInfoback to summary
private OriginatorInformation originatorInfo
recipientInfoStoreback to summary
pack-priv RecipientInformationStore recipientInfoStore
unprotectedAttributesback to summary
private ASN1Set unprotectedAttributes

Constructor Detail

CMSEnvelopedDataback to summary
public CMSEnvelopedData(byte[] envelopedData) throws CMSException
CMSEnvelopedDataback to summary
public CMSEnvelopedData(InputStream envelopedData) throws CMSException
CMSEnvelopedDataback to summary
public CMSEnvelopedData(ContentInfo contentInfo) throws CMSException

Construct a CMSEnvelopedData object from a content info object.

Parameters
contentInfo:ContentInfo

the contentInfo containing the CMS EnvelopedData object.

Exceptions
CMSException:
in the case where malformed content is encountered.

Method Detail

getContentEncryptionAlgorithmback to summary
public AlgorithmIdentifier getContentEncryptionAlgorithm()

Return the content encryption algorithm details for the data in this object.

Returns:AlgorithmIdentifier

AlgorithmIdentifier representing the content encryption algorithm.

getEncodedback to summary
public byte[] getEncoded() throws IOException

Implements org.bouncycastle.util.Encodable.getEncoded.

return the ASN.1 encoded representation of this object.

Returns:byte[]

Doc from org.bouncycastle.util.Encodable.getEncoded.

a byte array representing the encoding.

Exceptions
IOException:

Doc from org.bouncycastle.util.Encodable.getEncoded.

if an issue arises generation the encoding.

getEncryptionAlgOIDback to summary
public String getEncryptionAlgOID()

return the object identifier for the content encryption algorithm.

getEncryptionAlgParamsback to summary
public byte[] getEncryptionAlgParams()

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

getOriginatorInfoback to summary
public OriginatorInformation getOriginatorInfo()

Return the originator information associated with this message if present.

Returns:OriginatorInformation

OriginatorInformation, null if not present.

getRecipientInfosback to summary
public RecipientInformationStore getRecipientInfos()

return a store of the intended recipients for this message

getUnprotectedAttributesback to summary
public AttributeTable getUnprotectedAttributes()

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

toASN1Structureback to summary
public ContentInfo toASN1Structure()

return the ContentInfo