Merge pull request #2581 from reaperhulk/crlentry-invaliditydate
add invaliditydate class for crl entry extensions
diff --git a/src/cryptography/x509/extensions.py b/src/cryptography/x509/extensions.py
index 89172cb..0eed21b 100644
--- a/src/cryptography/x509/extensions.py
+++ b/src/cryptography/x509/extensions.py
@@ -133,6 +133,9 @@
def __ne__(self, other):
return not self == other
+ def __hash__(self):
+ return hash(self.crl_number)
+
def __repr__(self):
return "<CRLNumber({0})>".format(self.crl_number)
diff --git a/tests/test_x509_ext.py b/tests/test_x509_ext.py
index f7be4bb..a12a48f 100644
--- a/tests/test_x509_ext.py
+++ b/tests/test_x509_ext.py
@@ -1610,6 +1610,13 @@
with pytest.raises(TypeError):
x509.CRLNumber("notanumber")
+ def test_hash(self):
+ c1 = x509.CRLNumber(1)
+ c2 = x509.CRLNumber(1)
+ c3 = x509.CRLNumber(2)
+ assert hash(c1) == hash(c2)
+ assert hash(c1) != hash(c3)
+
class TestSubjectAlternativeName(object):
def test_get_values_for_type(self):