public CmsAuthenticatedData( ContentInfo contentInfo) { this.contentInfo = contentInfo; AuthenticatedData authData = AuthenticatedData.GetInstance(contentInfo.Content); // // read the encapsulated content info // ContentInfo encInfo = authData.EncapsulatedContentInfo; this.macAlg = authData.MacAlgorithm; this.mac = authData.Mac.GetOctets(); // // load the RecipientInfoStore // byte[] contentOctets = Asn1OctetString.GetInstance(encInfo.Content).GetOctets(); IList infos = CmsEnvelopedHelper.ReadRecipientInfos( authData.RecipientInfos, contentOctets, null, macAlg, null); this.authAttrs = authData.AuthAttrs; this.recipientInfoStore = new RecipientInformationStore(infos); this.unauthAttrs = authData.UnauthAttrs; }
public CmsAuthEnvelopedData( ContentInfo contentInfo) { this.contentInfo = contentInfo; AuthEnvelopedData authEnvData = AuthEnvelopedData.GetInstance(contentInfo.Content); this.originator = authEnvData.OriginatorInfo; // // read the encrypted content info // EncryptedContentInfo authEncInfo = authEnvData.AuthEncryptedContentInfo; this.authEncAlg = authEncInfo.ContentEncryptionAlgorithm; // // load the RecipientInfoStore // byte[] contentOctets = authEncInfo.EncryptedContent.GetOctets(); IList infos = CmsEnvelopedHelper.ReadRecipientInfos( authEnvData.RecipientInfos, contentOctets, null, null, authEncAlg); this.recipientInfoStore = new RecipientInformationStore(infos); // FIXME These need to be passed to the AEAD cipher as AAD (Additional Authenticated Data) this.authAttrs = authEnvData.AuthAttrs; this.mac = authEnvData.Mac.GetOctets(); this.unauthAttrs = authEnvData.UnauthAttrs; }
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(); // // load the RecipientInfoStore // Asn1SetParser s = authData.GetRecipientInfos(); IList baseInfos = new ArrayList(); IAsn1Convertible entry; while ((entry = s.ReadObject()) != null) { baseInfos.Add(RecipientInfo.GetInstance(entry.ToAsn1Object())); } this.macAlg = authData.GetMacAlgorithm(); // // read the encrypted content info // ContentInfoParser data = authData.GetEnapsulatedContentInfo(); // // prime the recipients // Stream contentStream = ((Asn1OctetStringParser)data.GetContent(Asn1Tags.OctetString)).GetOctetStream(); IList infos = CmsEnvelopedHelper.ReadRecipientInfos( baseInfos, contentStream, null, macAlg, null); _recipientInfoStore = new RecipientInformationStore(infos); }
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; // // load the RecipientInfoStore // Asn1SetParser s = this.envelopedData.GetRecipientInfos(); IList baseInfos = new ArrayList(); IAsn1Convertible entry; while ((entry = s.ReadObject()) != null) { baseInfos.Add(RecipientInfo.GetInstance(entry.ToAsn1Object())); } // // read the encrypted content info // EncryptedContentInfoParser encInfo = this.envelopedData.GetEncryptedContentInfo(); this._encAlg = encInfo.ContentEncryptionAlgorithm; // // prime the recipients // Stream contentStream = ((Asn1OctetStringParser)encInfo.GetEncryptedContent(Asn1Tags.OctetString)).GetOctetStream(); IList infos = CmsEnvelopedHelper.ReadRecipientInfos( baseInfos, contentStream, _encAlg, null, null); this.recipientInfoStore = new RecipientInformationStore(infos); }
public CmsEnvelopedData( ContentInfo contentInfo) { this.contentInfo = contentInfo; EnvelopedData envData = EnvelopedData.GetInstance(contentInfo.Content); // // read the encrypted content info // EncryptedContentInfo encInfo = envData.EncryptedContentInfo; this.encAlg = encInfo.ContentEncryptionAlgorithm; // // load the RecipientInfoStore // byte[] contentOctets = encInfo.EncryptedContent.GetOctets(); IList infos = CmsEnvelopedHelper.ReadRecipientInfos( envData.RecipientInfos, contentOctets, encAlg, null, null); this.recipientInfoStore = new RecipientInformationStore(infos); this.unprotectedAttributes = envData.UnprotectedAttrs; }