コード例 #1
0
        public CmsAuthenticatedData(
            ContentInfo contentInfo)
        {
            this.contentInfo = contentInfo;

            AuthenticatedData authData = AuthenticatedData.GetInstance(contentInfo.Content);

            //
            // read the recipients
            //
            Asn1Set recipientInfos = authData.RecipientInfos;

            this.macAlg = authData.MacAlgorithm;

            //
            // read the authenticated content info
            //
            ContentInfo encInfo  = authData.EncapsulatedContentInfo;
            CmsReadable readable = new CmsProcessableByteArray(
                Asn1OctetString.GetInstance(encInfo.Content).GetOctets());
            CmsSecureReadable secureReadable = new CmsEnvelopedHelper.CmsAuthenticatedSecureReadable(
                this.macAlg, readable);

            //
            // build the RecipientInformationStore
            //
            this.recipientInfoStore = CmsEnvelopedHelper.BuildRecipientInformationStore(
                recipientInfos, secureReadable);

            this.authAttrs   = authData.AuthAttrs;
            this.mac         = authData.Mac.GetOctets();
            this.unauthAttrs = authData.UnauthAttrs;
        }
コード例 #2
0
        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);
        }
コード例 #3
0
		public CmsAuthenticatedData(
			ContentInfo contentInfo)
		{
			this.contentInfo = contentInfo;

			AuthenticatedData authData = AuthenticatedData.GetInstance(contentInfo.Content);

			//
			// read the recipients
			//
			Asn1Set recipientInfos = authData.RecipientInfos;

			this.macAlg = authData.MacAlgorithm;

			//
			// read the authenticated content info
			//
			ContentInfo encInfo = authData.EncapsulatedContentInfo;
			CmsReadable readable = new CmsProcessableByteArray(
				Asn1OctetString.GetInstance(encInfo.Content).GetOctets());
			CmsSecureReadable secureReadable = new CmsEnvelopedHelper.CmsAuthenticatedSecureReadable(
				this.macAlg, readable);

			//
			// build the RecipientInformationStore
			//
			this.recipientInfoStore = CmsEnvelopedHelper.BuildRecipientInformationStore(
				recipientInfos, secureReadable);

			this.authAttrs = authData.AuthAttrs;
			this.mac = authData.Mac.GetOctets();
			this.unauthAttrs = authData.UnauthAttrs;
		}
コード例 #4
0
        public CmsAuthenticatedDataParser(Stream envelopedData) : base(envelopedData)
        {
            this.authAttrNotRead = true;
            this.authData        = new AuthenticatedDataParser((Asn1SequenceParser)this.contentInfo.GetContent(16));
            Asn1Set instance = Asn1Set.GetInstance(this.authData.GetRecipientInfos().ToAsn1Object());

            this.macAlg = this.authData.GetMacAlgorithm();
            ContentInfoParser enapsulatedContentInfo = this.authData.GetEnapsulatedContentInfo();
            CmsReadable       readable       = new CmsProcessableInputStream(((Asn1OctetStringParser)enapsulatedContentInfo.GetContent(4)).GetOctetStream());
            CmsSecureReadable secureReadable = new CmsEnvelopedHelper.CmsAuthenticatedSecureReadable(this.macAlg, readable);

            this._recipientInfoStore = CmsEnvelopedHelper.BuildRecipientInformationStore(instance, secureReadable);
        }
コード例 #5
0
        public CmsAuthenticatedData(ContentInfo contentInfo)
        {
            this.contentInfo = contentInfo;
            AuthenticatedData instance       = AuthenticatedData.GetInstance(contentInfo.Content);
            Asn1Set           recipientInfos = instance.RecipientInfos;

            this.macAlg = instance.MacAlgorithm;
            ContentInfo       encapsulatedContentInfo = instance.EncapsulatedContentInfo;
            CmsReadable       readable       = new CmsProcessableByteArray(Asn1OctetString.GetInstance(encapsulatedContentInfo.Content).GetOctets());
            CmsSecureReadable secureReadable = new CmsEnvelopedHelper.CmsAuthenticatedSecureReadable(this.macAlg, readable);

            this.recipientInfoStore = CmsEnvelopedHelper.BuildRecipientInformationStore(recipientInfos, secureReadable);
            this.authAttrs          = instance.AuthAttrs;
            this.mac         = instance.Mac.GetOctets();
            this.unauthAttrs = instance.UnauthAttrs;
        }
コード例 #6
0
		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);
		}