aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/cert/x509/x509_ext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/cert/x509/x509_ext.cpp')
-rw-r--r--src/lib/cert/x509/x509_ext.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/lib/cert/x509/x509_ext.cpp b/src/lib/cert/x509/x509_ext.cpp
index f058357c1..f56014ab7 100644
--- a/src/lib/cert/x509/x509_ext.cpp
+++ b/src/lib/cert/x509/x509_ext.cpp
@@ -128,19 +128,26 @@ void Extensions::decode_from(BER_Decoder& from_source)
Certificate_Extension* ext = get_extension(oid);
- if(!ext)
- {
- if(!critical || !should_throw)
- continue;
-
+ if(!ext && critical && m_throw_on_unknown_critical)
throw Decoding_Error("Encountered unknown X.509 extension marked "
"as critical; OID = " + oid.as_string());
- }
- ext->decode_inner(value);
+ if(ext)
+ {
+ try
+ {
+ ext->decode_inner(value);
+ }
+ catch(std::exception& e)
+ {
+ throw Decoding_Error("Exception while decoding extension " +
+ oid.as_string() + ": " + e.what());
+ }
- extensions.push_back(std::make_pair(ext, critical));
+ extensions.push_back(std::make_pair(ext, critical));
+ }
}
+
sequence.verify_end();
}