aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-06-23 06:47:38 +0000
committerlloyd <[email protected]>2006-06-23 06:47:38 +0000
commit4248def7fa3a7ef45e27b971e83a383ada68031a (patch)
tree4c3d83c5aebeef9c48c4bb2606e10197aaac4940
parentd0b18a83f2f60a20ae71caa9550886ee78f3e777 (diff)
Use Extensions for decoding a CRL entry
-rw-r--r--src/crl_ent.cpp40
1 files changed, 11 insertions, 29 deletions
diff --git a/src/crl_ent.cpp b/src/crl_ent.cpp
index 8c6d79b5e..e2348a0cb 100644
--- a/src/crl_ent.cpp
+++ b/src/crl_ent.cpp
@@ -91,35 +91,17 @@ void CRL_Entry::decode_from(BER_Decoder& source)
if(source.more_items())
{
- BER_Decoder crl_entry_exts = source.start_cons(SEQUENCE);
- while(crl_entry_exts.more_items())
- {
- Extension extn;
- crl_entry_exts.decode(extn);
-
- BER_Decoder value(extn.value);
-
- if(extn.oid == OIDS::lookup("X509v3.ReasonCode"))
- {
- u32bit reason_code;
- value.decode(reason_code, ENUMERATED, UNIVERSAL);
- reason = CRL_Code(reason_code);
- }
- else if(extn.critical)
- {
- std::string action =
- Config::get_string("x509/crl/unknown_critical");
-
- if(action == "throw")
- throw Decoding_Error("Unknown critical CRL entry extn " +
- extn.oid.as_string());
- else if(action != "ignore")
- throw Invalid_Argument("Bad setting x509/crl/unknown_critical: "
- + action);
- }
- value.verify_end();
- }
- source.end_cons();
+ std::string action = Config::get_string("x509/crl/unknown_critical");
+
+ if(action != "throw" && action != "ignore")
+ throw Invalid_Argument("Bad setting x509/crl/unknown_critical: "
+ + action);
+
+ Extensions extensions(action == "throw");
+ source.decode(extensions);
+ Data_Store info;
+ extensions.contents_to(info, info);
+ reason = CRL_Code(info.get1_u32bit("X509v3.CRLReasonCode"));
}
serial = BigInt::encode(serial_number_bn);