diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptography/x509.py | 20 |
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): |