private PkixCertPathValidatorResult DoTest( string trustAnchor, string[] certs, string[] crls, ISet policies) { ISet trustedSet = new HashSet(); trustedSet.Add(GetTrustAnchor(trustAnchor)); IList x509Certs = new ArrayList(); IList x509Crls = new ArrayList(); X509Certificate endCert = LoadCert(certs[certs.Length - 1]); for (int i = 0; i != certs.Length - 1; i++) { x509Certs.Add(LoadCert(certs[i])); } x509Certs.Add(endCert); PkixCertPath certPath = new PkixCertPath(x509Certs); for (int i = 0; i != crls.Length; i++) { x509Crls.Add(LoadCrl(crls[i])); } IX509Store x509CertStore = X509StoreFactory.Create( "Certificate/Collection", new X509CollectionStoreParameters(x509Certs)); IX509Store x509CrlStore = X509StoreFactory.Create( "CRL/Collection", new X509CollectionStoreParameters(x509Crls)); // CertPathValidator validator = CertPathValidator.GetInstance("PKIX"); PkixCertPathValidator validator = new PkixCertPathValidator(); PkixParameters parameters = new PkixParameters(trustedSet); parameters.AddStore(x509CertStore); parameters.AddStore(x509CrlStore); parameters.IsRevocationEnabled = true; if (policies != null) { parameters.IsExplicitPolicyRequired = true; parameters.SetInitialPolicies(policies); } // Perform validation as of this date since test certs expired parameters.Date = new DateTimeObject(DateTime.Parse("1/1/2011")); return validator.Validate(certPath, parameters); }