aboutsummaryrefslogtreecommitdiffstats
path: root/src/cryptography/x509/extensions.py
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2015-12-30 10:58:25 -0600
committerPaul Kehrer <paul.l.kehrer@gmail.com>2015-12-30 10:58:25 -0600
commit14fd697c5c4a2435b2113e425c95ac9c05702cc2 (patch)
tree08c194803532e2d49184565a8f7a3cf22b63826f /src/cryptography/x509/extensions.py
parent42e0c790c5150bec47add345065929ca7df8e6ff (diff)
downloadcryptography-14fd697c5c4a2435b2113e425c95ac9c05702cc2.tar.gz
cryptography-14fd697c5c4a2435b2113e425c95ac9c05702cc2.tar.bz2
cryptography-14fd697c5c4a2435b2113e425c95ac9c05702cc2.zip
add UnrecognizedExtension class
Diffstat (limited to 'src/cryptography/x509/extensions.py')
-rw-r--r--src/cryptography/x509/extensions.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/cryptography/x509/extensions.py b/src/cryptography/x509/extensions.py
index 4e7a53b6..0c5b5523 100644
--- a/src/cryptography/x509/extensions.py
+++ b/src/cryptography/x509/extensions.py
@@ -1065,3 +1065,34 @@ class InvalidityDate(object):
return hash(self.invalidity_date)
invalidity_date = utils.read_only_property("_invalidity_date")
+
+
+@utils.register_interface(ExtensionType)
+class UnrecognizedExtension(object):
+ def __init__(self, oid, value):
+ if not isinstance(oid, ObjectIdentifier):
+ raise TypeError("oid must be an ObjectIdentifier")
+ self._oid = oid
+ self._value = value
+
+ oid = utils.read_only_property("_oid")
+ value = utils.read_only_property("_value")
+
+ def __repr__(self):
+ return (
+ "<UnrecognizedExtension(oid={0.oid}, value={0.value!r})>".format(
+ self
+ )
+ )
+
+ def __eq__(self, other):
+ if not isinstance(other, UnrecognizedExtension):
+ return NotImplemented
+
+ return self.oid == other.oid and self.value == other.value
+
+ def __ne__(self, other):
+ return not self == other
+
+ def __hash__(self):
+ return hash((self.oid, self.value))