aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/x509/base.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/cryptography/x509/base.py b/src/cryptography/x509/base.py
index 2b4eeb56..f58b5221 100644
--- a/src/cryptography/x509/base.py
+++ b/src/cryptography/x509/base.py
@@ -79,6 +79,13 @@ class Extensions(object):
raise ExtensionNotFound("No {0} extension was found".format(oid), oid)
+ def get_extension_for_class(self, extclass):
+ for ext in self:
+ if type(ext.value) == extclass:
+ return ext
+
+ raise ExtensionNotFound("No {0} extension was found".format(extclass), extclass)
+
def __iter__(self):
return iter(self._extensions)