aboutsummaryrefslogtreecommitdiffstats
path: root/src/cryptography/x509
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2017-09-14 04:24:20 +0800
committerAlex Gaynor <alex.gaynor@gmail.com>2017-09-13 16:24:20 -0400
commitbdad051b9987951b4838e5c3458f6ba38b4e2ccf (patch)
tree99b6bf66719e9baa79cb1639bd2dadacdac404b8 /src/cryptography/x509
parent54024493bd50ea6f27aa094dce2d0ddac43221f0 (diff)
downloadcryptography-bdad051b9987951b4838e5c3458f6ba38b4e2ccf.tar.gz
cryptography-bdad051b9987951b4838e5c3458f6ba38b4e2ccf.tar.bz2
cryptography-bdad051b9987951b4838e5c3458f6ba38b4e2ccf.zip
name constraints __hash__ (#3912)
Diffstat (limited to 'src/cryptography/x509')
-rw-r--r--src/cryptography/x509/extensions.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/cryptography/x509/extensions.py b/src/cryptography/x509/extensions.py
index 44d5be94..01378b38 100644
--- a/src/cryptography/x509/extensions.py
+++ b/src/cryptography/x509/extensions.py
@@ -973,6 +973,19 @@ class NameConstraints(object):
u"excluded_subtrees={0.excluded_subtrees})>".format(self)
)
+ def __hash__(self):
+ if self.permitted_subtrees is not None:
+ ps = tuple(self.permitted_subtrees)
+ else:
+ ps = None
+
+ if self.excluded_subtrees is not None:
+ es = tuple(self.excluded_subtrees)
+ else:
+ es = None
+
+ return hash((ps, es))
+
permitted_subtrees = utils.read_only_property("_permitted_subtrees")
excluded_subtrees = utils.read_only_property("_excluded_subtrees")