(CkPython) Load PFX (PKCS#12) and List Certificates
Loads a PFX file (.pfx, .p12) and iterates over the certificates found within. Note: This example requires Chilkat v10.1.2 or greater.
import sys
import chilkat
certStore = chilkat.CkCertStore()
pfxPath = "/Users/chilkat/testData/pfx/chilkat_ssl.pfx"
pfxPassword = "test"
success = certStore.LoadPfxFile(pfxPath,pfxPassword)
if (success != True):
print(certStore.lastErrorText())
sys.exit()
numCerts = certStore.get_NumCertificates()
print("PFX contains " + str(numCerts) + " certificates")
cert = chilkat.CkCert()
i = 0
while i < numCerts :
certStore.GetCert(i,cert)
print(str(i) + ": (Common Name) " + cert.subjectCN())
print(str(i) + ": (Serial Number) " + cert.serialNumber())
print(str(i) + ": (Distinguished Name) " + cert.subjectDN())
i = i + 1
|