Decode Pem Certificate Python In this post, we will learn how to decode certificate (pem file) in python. Below python code is using pyasn1 library to read certificate pem version and parsing it into asn1 as per rfc2459 spec. from pyasn1_modules import pem, rfc2459 from pyasn1.codec.der import decoder substrate = pem.readPemFromFile(open('cert.pem')) cert = decoder.decode(substrate, asn1Spec=rfc2459.Certificate())[0] print(cert.prettyPrint()) Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.