Esempio n. 1
0
    public static CmsSignedData ReplaceCertificatesAndCrls(CmsSignedData signedData, IX509Store x509Certs, IX509Store x509Crls, IX509Store x509AttrCerts)
    {
        if (x509AttrCerts != null)
        {
            throw Platform.CreateNotImplementedException("Currently can't replace attribute certificates");
        }
        CmsSignedData cmsSignedData = new CmsSignedData(signedData);
        Asn1Set       certificates  = null;

        try
        {
            Asn1Set asn1Set = CmsUtilities.CreateBerSetFromList(CmsUtilities.GetCertificatesFromStore(x509Certs));
            if (asn1Set.Count != 0)
            {
                certificates = asn1Set;
            }
        }
        catch (X509StoreException e)
        {
            throw new CmsException("error getting certificates from store", e);
        }
        Asn1Set crls = null;

        try
        {
            Asn1Set asn1Set2 = CmsUtilities.CreateBerSetFromList(CmsUtilities.GetCrlsFromStore(x509Crls));
            if (asn1Set2.Count != 0)
            {
                crls = asn1Set2;
            }
        }
        catch (X509StoreException e2)
        {
            throw new CmsException("error getting CRLs from store", e2);
        }
        SignedData signedData2 = signedData.signedData;

        cmsSignedData.signedData  = new SignedData(signedData2.DigestAlgorithms, signedData2.EncapContentInfo, certificates, crls, signedData2.SignerInfos);
        cmsSignedData.contentInfo = new ContentInfo(cmsSignedData.contentInfo.ContentType, cmsSignedData.signedData);
        return(cmsSignedData);
    }
Esempio n. 2
0
 public void AddCrls(IX509Store crlStore)
 {
     CollectionUtilities.AddRange(_crls, CmsUtilities.GetCrlsFromStore(crlStore));
 }
 public OriginatorInfoGenerator(IX509Store origCerts, IX509Store origCrls)
 {
     this.origCerts = CmsUtilities.GetCertificatesFromStore(origCerts);
     this.origCrls  = ((origCrls == null) ? null : CmsUtilities.GetCrlsFromStore(origCrls));
 }