public CmsAuthenticatedDataParser(Stream envelopedData) : base(envelopedData) { authAttrNotRead = true; authData = new AuthenticatedDataParser((Asn1SequenceParser)contentInfo.GetContent(16)); Asn1Set instance = Asn1Set.GetInstance(authData.GetRecipientInfos().ToAsn1Object()); macAlg = authData.GetMacAlgorithm(); ContentInfoParser enapsulatedContentInfo = authData.GetEnapsulatedContentInfo(); CmsReadable readable = new CmsProcessableInputStream(((Asn1OctetStringParser)enapsulatedContentInfo.GetContent(4)).GetOctetStream()); CmsSecureReadable secureReadable = new CmsEnvelopedHelper.CmsAuthenticatedSecureReadable(macAlg, readable); _recipientInfoStore = CmsEnvelopedHelper.BuildRecipientInformationStore(instance, secureReadable); }
public CmsAuthenticatedData(ContentInfo contentInfo) { this.contentInfo = contentInfo; AuthenticatedData instance = AuthenticatedData.GetInstance(contentInfo.Content); Asn1Set recipientInfos = instance.RecipientInfos; macAlg = instance.MacAlgorithm; ContentInfo encapsulatedContentInfo = instance.EncapsulatedContentInfo; CmsReadable readable = new CmsProcessableByteArray(Asn1OctetString.GetInstance(encapsulatedContentInfo.Content).GetOctets()); CmsSecureReadable secureReadable = new CmsEnvelopedHelper.CmsAuthenticatedSecureReadable(macAlg, readable); recipientInfoStore = CmsEnvelopedHelper.BuildRecipientInformationStore(recipientInfos, secureReadable); authAttrs = instance.AuthAttrs; mac = instance.Mac.GetOctets(); unauthAttrs = instance.UnauthAttrs; }