Chilkat2-Python
Chilkat2-Python
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 Chilkat2-Python Downloads
import sys
import chilkat2
success = False
certStore = chilkat2.CertStore()
# 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 = chilkat2.Cert()
numCerts = certStore.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