public CmsEnvelopedDataParser(Stream envelopedData) : base(envelopedData) { _attrNotRead = true; this.envelopedData = new EnvelopedDataParser((Asn1SequenceParser)contentInfo.GetContent(16)); Asn1Set instance = Asn1Set.GetInstance(this.envelopedData.GetRecipientInfos().ToAsn1Object()); EncryptedContentInfoParser encryptedContentInfo = this.envelopedData.GetEncryptedContentInfo(); _encAlg = encryptedContentInfo.ContentEncryptionAlgorithm; CmsReadable readable = new CmsProcessableInputStream(((Asn1OctetStringParser)encryptedContentInfo.GetEncryptedContent(4)).GetOctetStream()); CmsSecureReadable secureReadable = new CmsEnvelopedHelper.CmsEnvelopedSecureReadable(_encAlg, readable); recipientInfoStore = CmsEnvelopedHelper.BuildRecipientInformationStore(instance, secureReadable); }
public CmsEnvelopedData(ContentInfo contentInfo) { this.contentInfo = contentInfo; EnvelopedData instance = EnvelopedData.GetInstance(contentInfo.Content); Asn1Set recipientInfos = instance.RecipientInfos; EncryptedContentInfo encryptedContentInfo = instance.EncryptedContentInfo; encAlg = encryptedContentInfo.ContentEncryptionAlgorithm; CmsReadable readable = new CmsProcessableByteArray(encryptedContentInfo.EncryptedContent.GetOctets()); CmsSecureReadable secureReadable = new CmsEnvelopedHelper.CmsEnvelopedSecureReadable(encAlg, readable); recipientInfoStore = CmsEnvelopedHelper.BuildRecipientInformationStore(recipientInfos, secureReadable); unprotectedAttributes = instance.UnprotectedAttrs; }