aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2015-05-02 19:34:51 -0500
committerPaul Kehrer <paul.l.kehrer@gmail.com>2015-05-02 19:34:51 -0500
commitb047617df8aeb51efed4ed761ff84c8b49cfced0 (patch)
tree3f6a8b7b6760e26e8617e96281eefa665f42e2c2 /src
parentc4b698e621df67ee100834a52b8c9846a681cf62 (diff)
downloadcryptography-b047617df8aeb51efed4ed761ff84c8b49cfced0.tar.gz
cryptography-b047617df8aeb51efed4ed761ff84c8b49cfced0.tar.bz2
cryptography-b047617df8aeb51efed4ed761ff84c8b49cfced0.zip
add eq/ne to ExtendedKeyUsage
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/x509.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/cryptography/x509.py b/src/cryptography/x509.py
index b22ac8be..6fcbfe6f 100644
--- a/src/cryptography/x509.py
+++ b/src/cryptography/x509.py
@@ -277,11 +277,10 @@ class Extension(object):
class ExtendedKeyUsage(object):
def __init__(self, usages):
- for oid in usages:
- if not isinstance(oid, ObjectIdentifier):
- raise TypeError(
- "Every item in the usages list must be an ObjectIdentifier"
- )
+ if not all(isinstance(x, ObjectIdentifier) for x in usages):
+ raise TypeError(
+ "Every item in the usages list must be an ObjectIdentifier"
+ )
self._usages = usages
@@ -294,6 +293,17 @@ class ExtendedKeyUsage(object):
def __repr__(self):
return "<ExtendedKeyUsage({0})>".format(self._usages)
+ def __eq__(self, other):
+ if not isinstance(other, ExtendedKeyUsage):
+ return NotImplemented
+
+ return (
+ self._usages == other._usages
+ )
+
+ def __ne__(self, other):
+ return not self == other
+
class BasicConstraints(object):
def __init__(self, ca, path_length):