Sample code for 30+ languages & platforms
Visual Basic 6.0

Windows Certificate Stores - Find Certificate by Common Name

See more Certificates Examples

Searches the Windows certificate stores for a certificate that matches the specified common name (CN).

Note: This example requires Chilkat v10.0.0 or greater.

Chilkat Visual Basic 6.0 Downloads

Visual Basic 6.0
Dim success As Long
success = 0

Dim cert As New ChilkatCert
success = cert.LoadByCommonName("Chilkat Software, Inc.")
If (success = 0) Then
    Debug.Print cert.LastErrorText
    Exit Sub
End If

Debug.Print cert.SubjectDN
Debug.Print "Success."