Sample code for 30+ languages & platforms
B4X Requires Chilkat v10.1.2+

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 B4X Downloads

B4X
Dim success As Boolean = False

Dim certStore As ChilkatCertStore
certStore.Initialize

'  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
    Log(certStore.LastErrorText)
    Return
End If


'  Find the certificate for the email address:
Dim jsonE As ChilkatJsonObject
jsonE.Initialize
jsonE.UpdateString("email", "joe@example.com")

Dim cert As ChilkatCert
cert.Initialize("cert")
success = certStore.FindCert(jsonE, cert)
If success = False Then
    Log(certStore.LastErrorText)
    Return
End If


Log("Found certificate: " & cert.SubjectDN)