/// <summary> /// Create PKI trust store provider instance. /// </summary> /// <param name="trustStore">Trust anchors</param> /// <param name="certificateRdnSelector">Certificate subject RDN selector for verifying certificate subject.</param> public PkiTrustStoreProvider(X509Store trustStore, ICertificateSubjectRdnSelector certificateRdnSelector) { if (trustStore == null) { throw new ArgumentNullException(nameof(trustStore)); } if (certificateRdnSelector == null) { throw new ArgumentNullException(nameof(certificateRdnSelector)); } _trustStore = trustStore; _certificateRdnSelector = certificateRdnSelector; }
/// <summary> /// Create PKCS#7 signature verifier instance. /// </summary> /// <param name="trustAnchors">Trust anchors to verify against</param> /// <param name="certificateRdnSelector">Certificate subject RDN selector. Used to verify that certificate subject contains specified RDN</param> public Pkcs7CryptoSignatureVerifier(X509Certificate2Collection trustAnchors, ICertificateSubjectRdnSelector certificateRdnSelector) { if (trustAnchors == null) { throw new ArgumentNullException(nameof(trustAnchors)); } if (certificateRdnSelector == null) { throw new ArgumentNullException(nameof(certificateRdnSelector)); } if (trustAnchors.Count == 0) { throw new ArgumentException("Non empty collection is expected.", nameof(trustAnchors)); } _trustAnchors = trustAnchors; _certificateRdnSelector = certificateRdnSelector; }
/// <summary> /// Create PKCS#7 signature verifier instance. /// </summary> /// <param name="trustAnchors">Trust anchors to verify against</param> /// <param name="certificateRdnSelector">Certificate subject RDN selector. Used to verify that certificate subject contains specified RDN</param> public Pkcs7CryptoSignatureVerifier(X509Certificate2Collection trustAnchors, ICertificateSubjectRdnSelector certificateRdnSelector) { if (trustAnchors == null || trustAnchors.Count == 0) { throw new ArgumentException("Non-empty collection required. Parameter: " + trustAnchors); } if (certificateRdnSelector == null) { throw new ArgumentNullException(nameof(certificateRdnSelector)); } _trustAnchors = new HashSet(); foreach (X509Certificate2 certificate in trustAnchors) { _trustAnchors.Add(new TrustAnchor(DotNetUtilities.FromX509Certificate(certificate), null)); } _certificateRdnSelector = certificateRdnSelector; }
public KeyBasedVerificationPolicy(X509Store trustStore, ICertificateSubjectRdnSelector certificateRdnSelector) : this() { }
/// <summary> /// Get PKCS#7 crypto signature verifier. /// <param name="trustStoreCertificates">Trust anchors to verify signature against</param> /// <param name="certificateRdnSelector">Certificate subject RDN selector for verifying certificate subject against specified RDN.</param> /// </summary> /// <returns>PKCS#7 verifier</returns> public ICryptoSignatureVerifier CreatePkcs7CryptoSignatureVerifier(X509Certificate2Collection trustStoreCertificates, ICertificateSubjectRdnSelector certificateRdnSelector) { return(new Pkcs7CryptoSignatureVerifier(trustStoreCertificates, certificateRdnSelector)); }
public CalendarAuthenticationRecordSignatureVerificationRule(X509Store trustStore, ICertificateSubjectRdnSelector certificateRdnSelector) { }
public static ICryptoSignatureVerifier GetCryptoSignatureVerifierByOid(string oid, X509Store trustStore, ICertificateSubjectRdnSelector certificateRdnSelector) { return(GetCryptoSignatureVerifierByOid(oid)); }
/// <summary> /// Get PKCS#7 crypto signature verifier. /// </summary> /// <param name="trustStore">trust anchors</param> /// <param name="certificateRdnSelector">Certificate subject RDN selector for verifying certificate subject.</param> /// <returns>PKCS#7 verifier</returns> public static ICryptoSignatureVerifier CreatePkcs7CryptoSignatureVerifier(X509Store trustStore, ICertificateSubjectRdnSelector certificateRdnSelector) { CheckCryptoProvider(); X509Certificate2Collection trustAnchors = null; if (trustStore != null) { // make certificates loading thread-safe lock (Lock) { trustStore.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly); trustAnchors = trustStore.Certificates; trustStore.Close(); } } return(_cryptoProvider.CreatePkcs7CryptoSignatureVerifier(trustAnchors, certificateRdnSelector)); }