public CmsEnvelopedDataParser(Stream envelopedData)
        : base(envelopedData)
    {
        _attrNotRead       = true;
        this.envelopedData = new EnvelopedDataParser((Asn1SequenceParser)contentInfo.GetContent(16));
        Asn1Set instance = Asn1Set.GetInstance(this.envelopedData.GetRecipientInfos().ToAsn1Object());
        EncryptedContentInfoParser encryptedContentInfo = this.envelopedData.GetEncryptedContentInfo();

        _encAlg = encryptedContentInfo.ContentEncryptionAlgorithm;
        CmsReadable       readable       = new CmsProcessableInputStream(((Asn1OctetStringParser)encryptedContentInfo.GetEncryptedContent(4)).GetOctetStream());
        CmsSecureReadable secureReadable = new CmsEnvelopedHelper.CmsEnvelopedSecureReadable(_encAlg, readable);

        recipientInfoStore = CmsEnvelopedHelper.BuildRecipientInformationStore(instance, secureReadable);
    }
    public CmsAuthenticatedDataParser(Stream envelopedData)
        : base(envelopedData)
    {
        authAttrNotRead = true;
        authData        = new AuthenticatedDataParser((Asn1SequenceParser)contentInfo.GetContent(16));
        Asn1Set instance = Asn1Set.GetInstance(authData.GetRecipientInfos().ToAsn1Object());

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

        _recipientInfoStore = CmsEnvelopedHelper.BuildRecipientInformationStore(instance, secureReadable);
    }
Пример #3
0
    public CmsEnvelopedData(ContentInfo contentInfo)
    {
        this.contentInfo = contentInfo;
        EnvelopedData        instance             = EnvelopedData.GetInstance(contentInfo.Content);
        Asn1Set              recipientInfos       = instance.RecipientInfos;
        EncryptedContentInfo encryptedContentInfo = instance.EncryptedContentInfo;

        encAlg = encryptedContentInfo.ContentEncryptionAlgorithm;
        CmsReadable       readable       = new CmsProcessableByteArray(encryptedContentInfo.EncryptedContent.GetOctets());
        CmsSecureReadable secureReadable = new CmsEnvelopedHelper.CmsEnvelopedSecureReadable(encAlg, readable);

        recipientInfoStore    = CmsEnvelopedHelper.BuildRecipientInformationStore(recipientInfos, secureReadable);
        unprotectedAttributes = instance.UnprotectedAttrs;
    }
    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;
    }
Пример #5
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;
    }