aboutsummaryrefslogtreecommitdiffstats
path: root/src/cryptography/x509
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2017-09-13 21:34:59 +0800
committerAlex Gaynor <alex.gaynor@gmail.com>2017-09-13 09:34:59 -0400
commitfbfc36da2a4769045f2373b004ddf0aff906cf38 (patch)
tree50bdea38adaed2a6969f642b40103ce6506d21df /src/cryptography/x509
parente535985a73a6aee349ac08b07ebe4f652b2eeb29 (diff)
downloadcryptography-fbfc36da2a4769045f2373b004ddf0aff906cf38.tar.gz
cryptography-fbfc36da2a4769045f2373b004ddf0aff906cf38.tar.bz2
cryptography-fbfc36da2a4769045f2373b004ddf0aff906cf38.zip
implement __hash__ on all GeneralName types (#3907)
Needed to implement __hash__ on AuthorityKeyIdentifier
Diffstat (limited to 'src/cryptography/x509')
-rw-r--r--src/cryptography/x509/general_name.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/cryptography/x509/general_name.py b/src/cryptography/x509/general_name.py
index abf3a48a..3ad71e4c 100644
--- a/src/cryptography/x509/general_name.py
+++ b/src/cryptography/x509/general_name.py
@@ -123,7 +123,7 @@ class RFC822Name(object):
return not self == other
def __hash__(self):
- return hash(self.value)
+ return hash(self.bytes_value)
def _idna_encode(value):
@@ -205,6 +205,9 @@ class DNSName(object):
def __ne__(self, other):
return not self == other
+ def __hash__(self):
+ return hash(self.bytes_value)
+
@utils.register_interface(GeneralName)
class UniformResourceIdentifier(object):
@@ -306,7 +309,7 @@ class UniformResourceIdentifier(object):
return not self == other
def __hash__(self):
- return hash(self.value)
+ return hash(self.bytes_value)
@utils.register_interface(GeneralName)
@@ -331,6 +334,9 @@ class DirectoryName(object):
def __ne__(self, other):
return not self == other
+ def __hash__(self):
+ return hash(self.value)
+
@utils.register_interface(GeneralName)
class RegisteredID(object):
@@ -354,6 +360,9 @@ class RegisteredID(object):
def __ne__(self, other):
return not self == other
+ def __hash__(self):
+ return hash(self.value)
+
@utils.register_interface(GeneralName)
class IPAddress(object):
@@ -389,6 +398,9 @@ class IPAddress(object):
def __ne__(self, other):
return not self == other
+ def __hash__(self):
+ return hash(self.value)
+
@utils.register_interface(GeneralName)
class OtherName(object):
@@ -416,3 +428,6 @@ class OtherName(object):
def __ne__(self, other):
return not self == other
+
+ def __hash__(self):
+ return hash((self.type_id, self.value))