aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/cryptography/hazmat/backends/openssl/x509.py11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/x509.py b/src/cryptography/hazmat/backends/openssl/x509.py
index 5e42b8e4..4896e9fb 100644
--- a/src/cryptography/hazmat/backends/openssl/x509.py
+++ b/src/cryptography/hazmat/backends/openssl/x509.py
@@ -227,18 +227,11 @@ class _Certificate(object):
return not self == other
def __hash__(self):
- # TODO: Using fingerprint() with SHA256 is way overkill.
- return hash(self.fingerprint(hashes.SHA256()))
+ return hash(self.public_bytes(serialization.Encoding.DER))
def fingerprint(self, algorithm):
h = hashes.Hash(algorithm, self._backend)
- bio = self._backend._create_mem_bio()
- res = self._backend._lib.i2d_X509_bio(
- bio, self._x509
- )
- assert res == 1
- der = self._backend._read_mem_bio(bio)
- h.update(der)
+ h.update(self.public_bytes(serialization.Encoding.DER))
return h.finalize()
@property