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);
}
| Modifier and Type | Field and Description |
|---|---|
| pack-priv ContentInfo | |
| private AlgorithmIdentifier | |
| private OriginatorInformation | |
| pack-priv RecipientInformationStore | |
| private ASN1Set |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | CMSEnvelopedData(ContentInfo
the contentInfo containing the CMS EnvelopedData object. contentInfo)Construct a CMSEnvelopedData object from a content info object. |
| Modifier and Type | Method and Description |
|---|---|
| private byte[] | |
| public AlgorithmIdentifier | Returns: AlgorithmIdentifier representing the content encryption algorithm.Return the content encryption algorithm details for the data in this object. |
| public byte[] | getEncoded()
Implements org. |
| public String | |
| 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.Return the originator information associated with this message if present. |
| public RecipientInformationStore | |
| public AttributeTable | getUnprotectedAttributes()
return a table of the unprotected attributes indexed by the OID of the attribute. |
| public ContentInfo |
| contentInfo | back to summary |
|---|---|
| pack-priv ContentInfo contentInfo | |
| encAlg | back to summary |
|---|---|
| private AlgorithmIdentifier encAlg | |
| originatorInfo | back to summary |
|---|---|
| private OriginatorInformation originatorInfo | |
| recipientInfoStore | back to summary |
|---|---|
| pack-priv RecipientInformationStore recipientInfoStore | |
| unprotectedAttributes | back to summary |
|---|---|
| private ASN1Set unprotectedAttributes | |
| CMSEnvelopedData | back to summary |
|---|---|
| public CMSEnvelopedData(byte[] envelopedData) throws CMSException | |
| CMSEnvelopedData | back to summary |
|---|---|
| public CMSEnvelopedData(InputStream envelopedData) throws CMSException | |
| CMSEnvelopedData | back to summary |
|---|---|
| public CMSEnvelopedData(ContentInfo contentInfo) throws CMSException Construct a CMSEnvelopedData object from a content info object.
| |
| encodeObj | back to summary |
|---|---|
| private byte[] encodeObj(ASN1Encodable obj) throws IOException | |
| getContentEncryptionAlgorithm | back to summary |
|---|---|
| public AlgorithmIdentifier getContentEncryptionAlgorithm() Return the content encryption algorithm details for the data in this object.
| |
| getEncoded | back to summary |
|---|---|
| public byte[] getEncoded() throws IOException Implements org. return the ASN.1 encoded representation of this object.
| |
| getEncryptionAlgOID | back to summary |
|---|---|
| public String getEncryptionAlgOID() return the object identifier for the content encryption algorithm. | |
| getEncryptionAlgParams | back to summary |
|---|---|
| public byte[] getEncryptionAlgParams() return the ASN.1 encoded encryption algorithm parameters, or null if there aren't any. | |
| getOriginatorInfo | back to summary |
|---|---|
| public OriginatorInformation getOriginatorInfo() Return the originator information associated with this message if present.
| |
| getRecipientInfos | back to summary |
|---|---|
| public RecipientInformationStore getRecipientInfos() return a store of the intended recipients for this message | |
| getUnprotectedAttributes | back to summary |
|---|---|
| public AttributeTable getUnprotectedAttributes() return a table of the unprotected attributes indexed by the OID of the attribute. | |
| toASN1Structure | back to summary |
|---|---|
| public ContentInfo toASN1Structure() return the ContentInfo | |