Add SHA-1 fingerprint

This commit is contained in:
Scott Wallace 2024-02-27 11:17:49 +00:00
parent 4fba7dbabf
commit e1f7fa0989
Signed by: scott
GPG key ID: AA742FDC5AFE2A72

View file

@ -11,6 +11,7 @@ from urllib.parse import urlparse
from cryptography import x509 from cryptography import x509
from cryptography.hazmat.backends import default_backend from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from tabulate import tabulate from tabulate import tabulate
SAN_GROUPING = 4 SAN_GROUPING = 4
@ -111,6 +112,10 @@ if __name__ == "__main__":
["Valid from", cert.not_valid_before_utc], ["Valid from", cert.not_valid_before_utc],
["Valid to", cert.not_valid_after_utc], ["Valid to", cert.not_valid_after_utc],
["Issuer", cert.issuer.rfc4514_string()], ["Issuer", cert.issuer.rfc4514_string()],
[
"SHA1 fingerprint",
":".join([format(i, "02x") for i in cert.fingerprint(hashes.SHA1())]),
],
] ]
print(tabulate(table, tablefmt="plain")) print(tabulate(table, tablefmt="plain"))