public CmsEnvelopedDataParser( Stream envelopedData) : base(envelopedData) { this._attrNotRead = true; this.envelopedData = new EnvelopedDataParser( (Asn1SequenceParser)this.contentInfo.GetContent(Asn1Tags.Sequence)); // TODO Validate version? //DerInteger version = this.envelopedData.Version; // // read the recipients // Asn1Set recipientInfos = Asn1Set.GetInstance(this.envelopedData.GetRecipientInfos().ToAsn1Object()); // // read the encrypted content info // EncryptedContentInfoParser encInfo = this.envelopedData.GetEncryptedContentInfo(); this._encAlg = encInfo.ContentEncryptionAlgorithm; CmsReadable readable = new CmsProcessableInputStream( ((Asn1OctetStringParser)encInfo.GetEncryptedContent(Asn1Tags.OctetString)).GetOctetStream()); CmsSecureReadable secureReadable = new CmsEnvelopedHelper.CmsEnvelopedSecureReadable( this._encAlg, readable); // // build the RecipientInformationStore // this.recipientInfoStore = CmsEnvelopedHelper.BuildRecipientInformationStore( recipientInfos, secureReadable); }
public CmsAuthenticatedDataParser( Stream envelopedData) : base(envelopedData) { this.authAttrNotRead = true; this.authData = new AuthenticatedDataParser( (Asn1SequenceParser)contentInfo.GetContent(Asn1Tags.Sequence)); // TODO Validate version? //DerInteger version = this.authData.getVersion(); // // read the recipients // Asn1Set recipientInfos = Asn1Set.GetInstance(authData.GetRecipientInfos().ToAsn1Object()); this.macAlg = authData.GetMacAlgorithm(); // // read the authenticated content info // ContentInfoParser data = authData.GetEnapsulatedContentInfo(); CmsReadable readable = new CmsProcessableInputStream( ((Asn1OctetStringParser)data.GetContent(Asn1Tags.OctetString)).GetOctetStream()); CmsSecureReadable secureReadable = new CmsEnvelopedHelper.CmsAuthenticatedSecureReadable( this.macAlg, readable); // // build the RecipientInformationStore // this._recipientInfoStore = CmsEnvelopedHelper.BuildRecipientInformationStore( recipientInfos, secureReadable); }