(CkPython) 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.
import sys
import chilkat
certStore = chilkat.CkCertStore()
# 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 = chilkat.CkJsonObject()
jsonE.UpdateString("email","joe@example.com")
cert = chilkat.CkCert()
success = certStore.FindCert(jsonE,cert)
if (success == False):
print(certStore.lastErrorText())
sys.exit()
print("Found certificate: " + cert.subjectDN())
|