aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2015-06-21 21:46:41 -0500
committerPaul Kehrer <paul.l.kehrer@gmail.com>2015-06-21 21:46:41 -0500
commit318942867e04bc1401d8957a51072a4a79a24957 (patch)
tree6cd81b5ef950337acf1630f54c94a7d6cf070053 /src
parent9fd9c0c791b5418a919456dd4183a7fd9cdbc919 (diff)
downloadcryptography-318942867e04bc1401d8957a51072a4a79a24957.tar.gz
cryptography-318942867e04bc1401d8957a51072a4a79a24957.tar.bz2
cryptography-318942867e04bc1401d8957a51072a4a79a24957.zip
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)