aboutsummaryrefslogtreecommitdiffstats
path: root/src/asn1
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-06-13 18:06:57 +0000
committerlloyd <[email protected]>2012-06-13 18:06:57 +0000
commit6dc2f28174e110427899727690c82a8d230c908e (patch)
tree0d092b56dd740b15552b211a2f9b7ffd50d59964 /src/asn1
parent9644a3ecebb15d8241e65dcae63bd6d0382a95a6 (diff)
Add support (decoding only) for the CRL Distribution Point extension.
Diffstat (limited to 'src/asn1')
-rw-r--r--src/asn1/ber_dec.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/asn1/ber_dec.h b/src/asn1/ber_dec.h
index e9f519d59..0d0d0ec72 100644
--- a/src/asn1/ber_dec.h
+++ b/src/asn1/ber_dec.h
@@ -97,6 +97,15 @@ class BOTAN_DLL BER_Decoder
const T& default_value = T());
template<typename T>
+ BER_Decoder& decode_optional_implicit(
+ T& out,
+ ASN1_Tag type_tag,
+ ASN1_Tag class_tag,
+ ASN1_Tag real_type,
+ ASN1_Tag real_class,
+ const T& default_value = T());
+
+ template<typename T>
BER_Decoder& decode_list(std::vector<T>& out,
ASN1_Tag type_tag = SEQUENCE,
ASN1_Tag class_tag = UNIVERSAL);
@@ -172,6 +181,35 @@ BER_Decoder& BER_Decoder::decode_optional(T& out,
}
/*
+* Decode an OPTIONAL or DEFAULT element
+*/
+template<typename T>
+BER_Decoder& BER_Decoder::decode_optional_implicit(
+ T& out,
+ ASN1_Tag type_tag,
+ ASN1_Tag class_tag,
+ ASN1_Tag real_type,
+ ASN1_Tag real_class,
+ const T& default_value)
+ {
+ BER_Object obj = get_next_object();
+
+ if(obj.type_tag == type_tag && obj.class_tag == class_tag)
+ {
+ obj.type_tag = real_type;
+ obj.class_tag = real_class;
+ push_back(obj);
+ decode(out, real_type, real_class);
+ }
+ else
+ {
+ out = default_value;
+ push_back(obj);
+ }
+
+ return (*this);
+ }
+/*
* Decode a list of homogenously typed values
*/
template<typename T>