Org.BouncyCastle.Asn1.Cms.AuthenticatedDataParser.GetEnapsulatedContentInfo C# (CSharp) Method

GetEnapsulatedContentInfo() public method

public GetEnapsulatedContentInfo ( ) : ContentInfoParser
return ContentInfoParser
	    public ContentInfoParser GetEnapsulatedContentInfo()
	    {
	        if (nextObject == null)
	        {
	            nextObject = seq.ReadObject();
	        }

	        if (nextObject != null)
	        {
	            Asn1SequenceParser o = (Asn1SequenceParser)nextObject;
	            nextObject = null;
	            return new ContentInfoParser(o);
	        }

	        return null;
	    }

Usage Example

		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);
		}