Sample code for 30+ languages & platforms
Chilkat2-Python

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 Chilkat2-Python Downloads

Chilkat2-Python
import sys
import chilkat2

success = False

certStore = chilkat2.CertStore()

# The "AddressBook" is the "Other People" certificate store as shown in certmgr.msc
readOnly = True
success = certStore.OpenWindowsStore("CurrentUser","AddressBook",readOnly)
if (success != True):
    print(certStore.LastErrorText)
    sys.exit()

# Find the certificate for the email address:
jsonE = chilkat2.JsonObject()
jsonE.UpdateString("email","joe@example.com")

cert = chilkat2.Cert()
success = certStore.FindCert(jsonE,cert)
if (success == False):
    print(certStore.LastErrorText)
    sys.exit()

print("Found certificate: " + cert.SubjectDN)