(Visual Basic 6.0) Find a Certificate in the "Other People" Windows Certificate Store
Demonstrates how to open the "Current User --> Other People" Windows certificate store, and locates a certificate matching an email address. Note: This example requires Chilkat v10.1.2 or greater.
Dim certStore As New ChilkatCertStore
' The "AddressBook" is the "Other People" certificate store as shown in certmgr.msc
Dim readOnly As Long
readOnly = 1
Dim success As Long
success = certStore.OpenWindowsStore("CurrentUser","AddressBook",readOnly)
If (success <> 1) Then
Debug.Print certStore.LastErrorText
Exit Sub
End If
' Find the certificate for the email address:
Dim jsonE As New ChilkatJsonObject
success = jsonE.UpdateString("email","joe@example.com")
Dim cert As New ChilkatCert
success = certStore.FindCert(jsonE,cert)
If (success = 0) Then
Debug.Print certStore.LastErrorText
Exit Sub
End If
Debug.Print "Found certificate: " & cert.SubjectDN
|