CryptoSys PKI examples VB6 to VB.NET

X509_VerifyCert

Verifies that an X.509 certificate has been signed by its issuer.

VB6/VBA

Debug.Print "Testing X509_VerifyCert ..."
' Returns 0 if OK, -1 if fails to validate, or +ve other error
Dim nRet As Long
nRet = X509_VerifyCert("myuser.cer", "myca.cer", 0)
If nRet = 0 Then
    Debug.Print "Verification is OK"
ElseIf nRet > 0 Then
    Debug.Print "Error: " & nRet & pkiGetLastError()
Else
    Debug.Print "Cert not issued by this Issuer"
End If

Output

Testing X509_VerifyCert ...
Verification is OK

VB.NET

Console.WriteLine("Testing X509_VerifyCert ...")
' Returns 0 if OK, -1 if fails to validate, or +ve other error
Dim nRet As Integer
nRet = X509.VerifyCert("myuser.cer", "myca.cer")
If nRet = 0 Then
    Console.WriteLine("Verification is OK")
ElseIf nRet > 0 Then
    Console.WriteLine("Error: " & nRet & General.LastError())
Else
    Console.WriteLine("Cert not issued by this Issuer")
End If

[Contents]


Copyright © 2010-20 D.I. Management Services Pty Limited ABN 78 083 210 584, Australia. All rights reserved.
<www.di-mgt.com.au> <www.cryptosys.net>

[HOME]

Copyright © 2010-20 D.I. Management Services Pty Ltd. All rights reserved.