Sample code for 30+ languages & platforms
Chilkat2-Python

Load CMS PKCS#7 Certificate (.p7b)

See more Certificates Examples

Loads a digital certificate from a Cryptographic Message Syntax Standard PKCS7 (.p7b) file and fetches information about the cert.

Chilkat Chilkat2-Python Downloads

Chilkat2-Python
import sys
import chilkat2

success = False

cert = chilkat2.Cert()

# LoadFromFile will load virtually any certificate format file.
# It will auto-recognize the format and load appropiately.

success = cert.LoadFromFile("/Users/chilkat/testData/cer/chilkat.p7b")
if (success != True):
    print(cert.LastErrorText)
    sys.exit()

# DN = "Distinguished Name"
print("SubjectDN:" + cert.SubjectDN)

print("Common Name:" + cert.SubjectCN)
print("Issuer Common Name:" + cert.IssuerCN)

print("Serial Number:" + cert.SerialNumber)