[VB6 equivalent: X509_ValidatePath
]
Dim nRet As Integer Dim strP7cFile As String Dim strTrustedCert As String Dim strCertList As String ' A p7c "certs-only" file which includes a self-signed cert strP7cFile = "testcerts1.p7c" nRet = X509.ValidatePath(strP7cFile, "", False) Console.WriteLine("X509_ValidatePath returns " & nRet & " (expected 0)") ' Same again but specify the trusted root cert ' (which is the same as the self-signed cert in the p7c file) strP7cFile = "testcerts1.p7c" strTrustedCert = "testcert00.cer" nRet = X509.ValidatePath(strP7cFile, strTrustedCert, False) Console.WriteLine("X509_ValidatePath returns " & nRet & " (expected 0)") ' Specify a cert list - testcert00.cer is the self-signed cert strCertList = "testcert00.cer;testcert03.cer;testcert01.cer;testcert02.cer" nRet = X509.ValidatePath(strCertList, "", False) Console.WriteLine("X509_ValidatePath returns " & nRet & " (expected 0)") ' Same again but specify the trusted root cert (this time it is not in the list) strCertList = "testcert01.cer;testcert02.cer;testcert03.cer" strTrustedCert = "testcert00.cer" nRet = X509.ValidatePath(strCertList, strTrustedCert, False) Console.WriteLine("X509_ValidatePath returns " & nRet & " (expected 0)")
See Also:
X509.ValidatePath Method