aboutsummaryrefslogtreecommitdiffstats
path: root/src/cryptography/x509/extensions.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2015-12-30 20:37:43 -0500
committerAlex Gaynor <alex.gaynor@gmail.com>2015-12-30 20:37:43 -0500
commit7640889dbbc379fe1f164cbd3094b2189aa655ba (patch)
tree39e6b91587b9c7e7ab602eaa399770e0e1eb320e /src/cryptography/x509/extensions.py
parentd72d8a250e79fb15bf5ccc74897f20336775725f (diff)
parent1628b5c33f92cdfdb77125782095f3028044939f (diff)
downloadcryptography-7640889dbbc379fe1f164cbd3094b2189aa655ba.tar.gz
cryptography-7640889dbbc379fe1f164cbd3094b2189aa655ba.tar.bz2
cryptography-7640889dbbc379fe1f164cbd3094b2189aa655ba.zip
Merge pull request #2604 from reaperhulk/unrecognized-extension-class
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))