aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2015-12-30 21:03:26 -0600
committerPaul Kehrer <paul.l.kehrer@gmail.com>2015-12-30 21:03:26 -0600
commite69c5fe0649adcfb1c540c39e2b296ad44cde244 (patch)
tree04baa988849f11c1b58ace4371864a1b9b2472ff /src
parent7640889dbbc379fe1f164cbd3094b2189aa655ba (diff)
downloadcryptography-e69c5fe0649adcfb1c540c39e2b296ad44cde244.tar.gz
cryptography-e69c5fe0649adcfb1c540c39e2b296ad44cde244.tar.bz2
cryptography-e69c5fe0649adcfb1c540c39e2b296ad44cde244.zip
don't allow UnrecognizedExtension with get_extension_for_class
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/x509/extensions.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/cryptography/x509/extensions.py b/src/cryptography/x509/extensions.py
index 0c5b5523..f7b5d7f5 100644
--- a/src/cryptography/x509/extensions.py
+++ b/src/cryptography/x509/extensions.py
@@ -91,6 +91,13 @@ class Extensions(object):
raise ExtensionNotFound("No {0} extension was found".format(oid), oid)
def get_extension_for_class(self, extclass):
+ if extclass is UnrecognizedExtension:
+ raise TypeError(
+ "UnrecognizedExtension can't be used with "
+ "get_extension_for_class because more than one instance of the"
+ " class may be present."
+ )
+
for ext in self:
if isinstance(ext.value, extclass):
return ext