aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rpkid/rpki/x509.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/rpkid/rpki/x509.py b/rpkid/rpki/x509.py
index 4cff5d05..540209d0 100644
--- a/rpkid/rpki/x509.py
+++ b/rpkid/rpki/x509.py
@@ -197,8 +197,17 @@ class DER_object(object):
return self.pem_converter.to_PEM(self.get_DER())
def __cmp__(self, other):
- """Compare two DER-encoded objects."""
- return cmp(self.get_DER(), other.get_DER())
+ """
+ Compare two DER-encoded objects.
+ """
+ if self is None and other is None:
+ return 0
+ elif self is None:
+ return -1
+ elif other is None:
+ return 1
+ else:
+ return cmp(self.get_DER(), other.get_DER())
def hSKI(self):
"""