How can I decode a pem-encoded (base64) certificate with Python? For example this here from github.com:
-----BEGIN CERTIFICATE----- MIIHKjCCBhKgAwIBAgIQDnd2i
This code dumps a cert file content:
import OpenSSL.crypto cert = OpenSSL.crypto.load_certificate( OpenSSL.crypto.FILETYPE_PEM, open('/path/to/cert/file.crt').read() ) print OpenSSL.crypto.dump_certificate(OpenSSL.crypto.FILETYPE_TEXT, cert)
Give it a go.