Chilkat2-Python
Chilkat2-Python
Load PFX (PKCS#12) and List Certificates
See more Certificates Examples
Loads a PFX file (.pfx, .p12) and iterates over the certificates found within.Chilkat Chilkat2-Python Downloads
import sys
import chilkat2
success = False
certStore = chilkat2.CertStore()
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.NumCertificates
print("PFX contains " + str(numCerts) + " certificates")
cert = chilkat2.Cert()
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