CkPython
CkPython
Iterate over Certificates in a Certificate Store
See more Cert Store Examples
Demonstrates how to iterate over the certificates in a certificate store.Note: Requires Chilkat v10.1.2 or later.
Chilkat CkPython Downloads
import sys
import chilkat
success = False
certStore = chilkat.CkCertStore()
# This opens the Current User certificate store on Windows,
# On MacOS and iOS it opens the default Keychain.
readOnly = False
success = certStore.OpenCurrentUserStore(readOnly)
if (success == False):
print(certStore.lastErrorText())
sys.exit()
cert = chilkat.CkCert()
numCerts = certStore.get_NumCertificates()
i = 0
while (i < numCerts) :
# Load the cert object with the Nth certificate.
certStore.GetCert(i,cert)
print(str(i) + ": " + cert.subjectCN())
i = i + 1