Exemple #1
0
        public CmsAuthEnvelopedData(
            ContentInfo contentInfo)
        {
            this.contentInfo = contentInfo;

            AuthEnvelopedData authEnvData = AuthEnvelopedData.GetInstance(contentInfo.Content);

            this.originator = authEnvData.OriginatorInfo;

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

            //
            // read the auth-encrypted content info
            //
            EncryptedContentInfo authEncInfo = authEnvData.AuthEncryptedContentInfo;

            this.authEncAlg = authEncInfo.ContentEncryptionAlgorithm;
            CmsSecureReadable secureReadable = new AuthEnvelopedSecureReadable(this);

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

            // 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;
        }
Exemple #2
0
        public CmsAuthEnvelopedData(ContentInfo contentInfo)
        {
            this.contentInfo = contentInfo;
            AuthEnvelopedData instance = AuthEnvelopedData.GetInstance(contentInfo.Content);

            originator = instance.OriginatorInfo;
            Asn1Set recipientInfos = instance.RecipientInfos;
            EncryptedContentInfo authEncryptedContentInfo = instance.AuthEncryptedContentInfo;

            authEncAlg = authEncryptedContentInfo.ContentEncryptionAlgorithm;
            CmsSecureReadable secureReadable = new AuthEnvelopedSecureReadable(this);

            recipientInfoStore = CmsEnvelopedHelper.BuildRecipientInformationStore(recipientInfos, secureReadable);
            authAttrs          = instance.AuthAttrs;
            mac         = instance.Mac.GetOctets();
            unauthAttrs = instance.UnauthAttrs;
        }