Example #1
0
        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 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;
        }
    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;
    }