aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2015-06-21 23:10:43 -0400
committerAlex Gaynor <alex.gaynor@gmail.com>2015-06-21 23:10:43 -0400
commit4117aa7ad1ac32f1e98560cafa06783eeb78b41b (patch)
tree6cd81b5ef950337acf1630f54c94a7d6cf070053 /src
parent9fd9c0c791b5418a919456dd4183a7fd9cdbc919 (diff)
parent318942867e04bc1401d8957a51072a4a79a24957 (diff)
downloadcryptography-4117aa7ad1ac32f1e98560cafa06783eeb78b41b.tar.gz
cryptography-4117aa7ad1ac32f1e98560cafa06783eeb78b41b.tar.bz2
cryptography-4117aa7ad1ac32f1e98560cafa06783eeb78b41b.zip
Merge pull request #2053 from reaperhulk/name-constraints-eq
add eq/ne support to NameConstraints
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/x509.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/cryptography/x509.py b/src/cryptography/x509.py
index 4dbe3da1..1d705e70 100644
--- a/src/cryptography/x509.py
+++ b/src/cryptography/x509.py
@@ -709,6 +709,18 @@ class NameConstraints(object):
self._permitted_subtrees = permitted_subtrees
self._excluded_subtrees = excluded_subtrees
+ def __eq__(self, other):
+ if not isinstance(other, NameConstraints):
+ return NotImplemented
+
+ return (
+ self.excluded_subtrees == other.excluded_subtrees and
+ self.permitted_subtrees == other.permitted_subtrees
+ )
+
+ def __ne__(self, other):
+ return not self == other
+
def _validate_ip_name(self, tree):
if any(isinstance(name, IPAddress) and not isinstance(
name.value, (ipaddress.IPv4Network, ipaddress.IPv6Network)