Sample code for 30+ languages & platforms
VB.NET

Find a Certificate in the "Other People" Windows Certificate Store

See more Certificates Examples

Demonstrates how to open the "Current User --> Other People" Windows certificate store, and locates a certificate matching an email address.

Chilkat VB.NET Downloads

VB.NET
Dim success As Boolean = False

Dim certStore As New Chilkat.CertStore

' The "AddressBook" is the "Other People" certificate store as shown in certmgr.msc
Dim readOnly As Boolean = True
success = 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)