Skip to content

Instantly share code, notes, and snippets.

@alastairmccormack
Created November 13, 2015 03:40
Show Gist options
  • Save alastairmccormack/e7b0bc65927b7987b7d4 to your computer and use it in GitHub Desktop.
Save alastairmccormack/e7b0bc65927b7987b7d4 to your computer and use it in GitHub Desktop.
Gets a SHA1 fingerprint from an x509 certificate using Python and OpenSSL crypto module
from OpenSSL.crypto import load_certificate, FILETYPE_PEM
cert_file_string = open("esx.crt", "rb").read()
cert = load_certificate(FILETYPE_PEM, cert_file_string)
sha1_fingerprint = cert.digest("sha1")
print sha1_fingerprint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment