aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2015-07-08 20:59:16 -0400
committerAlex Gaynor <alex.gaynor@gmail.com>2015-07-08 20:59:16 -0400
commit978137d89e99314e823ab206d482d23e6a830329 (patch)
treedb7255ef8add97cc87ef32552d0084c8bc1e7744 /src
parent366b0f8385bc1a35c25a4316f315c33a84348261 (diff)
downloadcryptography-978137d89e99314e823ab206d482d23e6a830329.tar.gz
cryptography-978137d89e99314e823ab206d482d23e6a830329.tar.bz2
cryptography-978137d89e99314e823ab206d482d23e6a830329.zip
Fixed #2127 -- added __hash__ to CSR
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/hazmat/backends/openssl/x509.py3
-rw-r--r--src/cryptography/x509.py6
2 files changed, 9 insertions, 0 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/x509.py b/src/cryptography/hazmat/backends/openssl/x509.py
index 68104e69..a4013389 100644
--- a/src/cryptography/hazmat/backends/openssl/x509.py
+++ b/src/cryptography/hazmat/backends/openssl/x509.py
@@ -709,6 +709,9 @@ class _CertificateSigningRequest(object):
def __ne__(self, other):
return not self == other
+ def __hash__(self):
+ return hash(self.public_bytes(serialization.Encoding.DER))
+
def public_key(self):
pkey = self._backend._lib.X509_REQ_get_pubkey(self._x509_req)
assert pkey != self._backend._ffi.NULL
diff --git a/src/cryptography/x509.py b/src/cryptography/x509.py
index f8134958..0ad1d4f9 100644
--- a/src/cryptography/x509.py
+++ b/src/cryptography/x509.py
@@ -1410,6 +1410,12 @@ class CertificateSigningRequest(object):
"""
@abc.abstractmethod
+ def __hash__(self):
+ """
+ Computes a hash.
+ """
+
+ @abc.abstractmethod
def public_key(self):
"""
Returns the public key