(VB.NET) 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 Chilkat.CertStore
' The "AddressBook" is the "Other People" certificate store as shown in certmgr.msc
Dim readOnly As Boolean = True
Dim success As Boolean = certStore.OpenWindowsStore("CurrentUser","AddressBook",readOnly)
If (success <> True) Then
Debug.WriteLine(certStore.LastErrorText)
Exit Sub
End If
' Find the certificate for the email address:
Dim jsonE As New Chilkat.JsonObject
jsonE.UpdateString("email","joe@example.com")
Dim cert As New Chilkat.Cert
success = certStore.FindCert(jsonE,cert)
If (success = False) Then
Debug.WriteLine(certStore.LastErrorText)
Exit Sub
End If
Debug.WriteLine("Found certificate: " & cert.SubjectDN)
|