From 58e870ca8ac61e4099fb9d5d9e10820d338f8671 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Sun, 17 May 2015 09:15:30 -0700 Subject: x509 extension equality --- src/cryptography/x509.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') 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 ("").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): -- cgit v1.2.3