From e1f7fa0989526c738032a7322d2262ad005aa690 Mon Sep 17 00:00:00 2001 From: Scott Wallace Date: Tue, 27 Feb 2024 11:17:49 +0000 Subject: [PATCH] Add SHA-1 fingerprint --- cert_deets.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cert_deets.py b/cert_deets.py index be6fc9a..b597b69 100644 --- a/cert_deets.py +++ b/cert_deets.py @@ -11,6 +11,7 @@ from urllib.parse import urlparse from cryptography import x509 from cryptography.hazmat.backends import default_backend +from cryptography.hazmat.primitives import hashes from tabulate import tabulate SAN_GROUPING = 4 @@ -111,6 +112,10 @@ if __name__ == "__main__": ["Valid from", cert.not_valid_before_utc], ["Valid to", cert.not_valid_after_utc], ["Issuer", cert.issuer.rfc4514_string()], + [ + "SHA1 fingerprint", + ":".join([format(i, "02x") for i in cert.fingerprint(hashes.SHA1())]), + ], ] print(tabulate(table, tablefmt="plain"))