Skip to content

Instantly share code, notes, and snippets.

@jbowes
Created July 20, 2012 19:03
Show Gist options
  • Save jbowes/3152602 to your computer and use it in GitHub Desktop.
Save jbowes/3152602 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import sys
from rhsm import _certificate
import zlib
fp = open(sys.argv[1], "r")
x509 = _certificate.load(pem=fp.read())
#x509 = _certificate.load(sys.argv[1])
print _certificate.get_all_extensions(x509)
print _certificate.get_serial_number(x509)
print _certificate.get_subject(x509)
print _certificate.get_not_before(x509)
print _certificate.get_not_after(x509)
print _certificate.get_extension(x509, "1.3.6.1.4.1.2312.9.6")
print zlib.decompress(_certificate.get_extension(x509, "1.3.6.1.4.1.2312.9.7"))
print _certificate.get_extension(x509, name="subjectAltName")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment