aboutsummaryrefslogtreecommitdiff
path: root/asn1crypto/x509.py
diff options
context:
space:
mode:
authorPim Coster <pimcoster@gmail.com>2017-05-20 19:56:51 +0200
committerPim Coster <pimcoster@gmail.com>2017-05-20 19:56:51 +0200
commit42e7a83a1eea7216e14f36810eb1a7a33b825241 (patch)
tree8e71a880108ac3cd3a8f92bfadb0f0cb627209ac /asn1crypto/x509.py
parent5cbae97e94d1d4d3f42cc0ca6bb330f516b1fde7 (diff)
downloadasn1crypto-42e7a83a1eea7216e14f36810eb1a7a33b825241.tar.gz
Add sha256_fingerprint property
Diffstat (limited to 'asn1crypto/x509.py')
-rw-r--r--asn1crypto/x509.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/asn1crypto/x509.py b/asn1crypto/x509.py
index 374f628..8c6f1eb 100644
--- a/asn1crypto/x509.py
+++ b/asn1crypto/x509.py
@@ -2518,6 +2518,16 @@ class Certificate(Sequence):
self._sha256 = hashlib.sha256(self.dump()).digest()
return self._sha256
+ @property
+ def sha256_fingerprint(self):
+ """
+ :return:
+ A unicode string of the SHA-256 hash, formatted using hex encoding
+ with a space between each pair of characters, all uppercase
+ """
+
+ return ' '.join('%02X' % c for c in bytes_to_list(self.sha256))
+
def is_valid_domain_ip(self, domain_ip):
"""
Check if a domain name or IP address is valid according to the