public SignatureDocument(CmsSignedData signedData) { _signedData = signedData; _certs = CmsUtilities.GetCertificatesFromStore(_signedData.GetCertificates("Collection")); _signaturePackaging = _signedData.SignedContent != null ? SignaturePackaging.ATTACHED_IMPLICIT : SignaturePackaging.DETACHED_EXPLICIT; ReadSignersInfo(); }
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); }
public void AddCertificates(IX509Store certStore) { CollectionUtilities.AddRange(_certs, CmsUtilities.GetCertificatesFromStore(certStore)); }
public OriginatorInfoGenerator(IX509Store origCerts, IX509Store origCrls) { this.origCerts = CmsUtilities.GetCertificatesFromStore(origCerts); this.origCrls = ((origCrls == null) ? null : CmsUtilities.GetCrlsFromStore(origCrls)); }