aboutsummaryrefslogtreecommitdiffstats
path: root/src/cryptography/x509
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2017-09-14 11:15:58 +0800
committerAlex Gaynor <alex.gaynor@gmail.com>2017-09-13 23:15:58 -0400
commit409a0c8d66a074033f7c6359c4f1578c9f479245 (patch)
treeba9c22a27dc773d66d4266cbaec904d3f8d1021e /src/cryptography/x509
parent5e9eeefe201e15f559f51953c8002a966cb9af1e (diff)
downloadcryptography-409a0c8d66a074033f7c6359c4f1578c9f479245.tar.gz
cryptography-409a0c8d66a074033f7c6359c4f1578c9f479245.tar.bz2
cryptography-409a0c8d66a074033f7c6359c4f1578c9f479245.zip
implement __hash__ on DistributionPoint and CRLDistributionPoints (#3915)
Diffstat (limited to 'src/cryptography/x509')
-rw-r--r--src/cryptography/x509/extensions.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/cryptography/x509/extensions.py b/src/cryptography/x509/extensions.py
index 7a03139f..442000e3 100644
--- a/src/cryptography/x509/extensions.py
+++ b/src/cryptography/x509/extensions.py
@@ -412,6 +412,9 @@ class CRLDistributionPoints(object):
def __getitem__(self, idx):
return self._distribution_points[idx]
+ def __hash__(self):
+ return hash(tuple(self._distribution_points))
+
class DistributionPoint(object):
def __init__(self, full_name, relative_name, reasons, crl_issuer):
@@ -487,6 +490,19 @@ class DistributionPoint(object):
def __ne__(self, other):
return not self == other
+ def __hash__(self):
+ if self.full_name is not None:
+ fn = tuple(self.full_name)
+ else:
+ fn = None
+
+ if self.crl_issuer is not None:
+ crl_issuer = tuple(self.crl_issuer)
+ else:
+ crl_issuer = None
+
+ return hash((fn, self.relative_name, self.reasons, crl_issuer))
+
full_name = utils.read_only_property("_full_name")
relative_name = utils.read_only_property("_relative_name")
reasons = utils.read_only_property("_reasons")