diff options
-rw-r--r-- | src/cryptography/x509/base.py | 7 |
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) |