diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2015-05-17 12:46:01 -0400 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2015-05-17 12:46:01 -0400 |
commit | b0391810fb74bd098592b03ffbb937daeed4561f (patch) | |
tree | 78ead3d4dfba1ef16bf661913da60c36482100f9 /src | |
parent | 4825b9ed835866b50a0cc3feb9fad9bc81d57ec1 (diff) | |
parent | 58e870ca8ac61e4099fb9d5d9e10820d338f8671 (diff) | |
download | cryptography-b0391810fb74bd098592b03ffbb937daeed4561f.tar.gz cryptography-b0391810fb74bd098592b03ffbb937daeed4561f.tar.bz2 cryptography-b0391810fb74bd098592b03ffbb937daeed4561f.zip |
Merge pull request #1968 from reaperhulk/ext-eq
x509 extension equality
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptography/x509.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/cryptography/x509.py b/src/cryptography/x509.py index ec2092bb..325d6d62 100644 --- a/src/cryptography/x509.py +++ b/src/cryptography/x509.py @@ -278,6 +278,19 @@ class Extension(object): return ("<Extension(oid={0.oid}, critical={0.critical}, " "value={0.value})>").format(self) + def __eq__(self, other): + if not isinstance(other, Extension): + return NotImplemented + + return ( + self.oid == other.oid and + self.critical == other.critical and + self.value == other.value + ) + + def __ne__(self, other): + return not self == other + class ExtendedKeyUsage(object): def __init__(self, usages): |