diff options
Diffstat (limited to 'src/asn1')
-rw-r--r-- | src/asn1/ber_dec.cpp | 9 | ||||
-rw-r--r-- | src/asn1/ber_dec.h | 15 |
2 files changed, 20 insertions, 4 deletions
diff --git a/src/asn1/ber_dec.cpp b/src/asn1/ber_dec.cpp index dbd59988b..51b952e71 100644 --- a/src/asn1/ber_dec.cpp +++ b/src/asn1/ber_dec.cpp @@ -232,6 +232,12 @@ BER_Object BER_Decoder::get_next_object() return next; } +BER_Decoder& BER_Decoder::get_next(BER_Object& ber) + { + ber = get_next_object(); + return (*this); + } + /* * Push a object back into the stream */ @@ -341,7 +347,8 @@ BER_Decoder::~BER_Decoder() /* * Request for an object to decode itself */ -BER_Decoder& BER_Decoder::decode(ASN1_Object& obj) +BER_Decoder& BER_Decoder::decode(ASN1_Object& obj, + ASN1_Tag, ASN1_Tag) { obj.decode_from(*this); return (*this); diff --git a/src/asn1/ber_dec.h b/src/asn1/ber_dec.h index 6b010fcc4..6ca9aa777 100644 --- a/src/asn1/ber_dec.h +++ b/src/asn1/ber_dec.h @@ -29,6 +29,8 @@ class BOTAN_DLL BER_Decoder BER_Decoder start_cons(ASN1_Tag type_tag, ASN1_Tag class_tag = UNIVERSAL); BER_Decoder& end_cons(); + BER_Decoder& get_next(BER_Object& ber); + BER_Decoder& raw_bytes(secure_vector<byte>& v); BER_Decoder& raw_bytes(std::vector<byte>& v); @@ -61,7 +63,9 @@ class BOTAN_DLL BER_Decoder ASN1_Tag type_tag, ASN1_Tag class_tag = CONTEXT_SPECIFIC); - BER_Decoder& decode(class ASN1_Object& obj); + BER_Decoder& decode(class ASN1_Object& obj, + ASN1_Tag type_tag = NO_OBJECT, + ASN1_Tag class_tag = NO_OBJECT); BER_Decoder& decode_octet_string_bigint(class BigInt& b); @@ -172,12 +176,17 @@ BER_Decoder& BER_Decoder::decode_list(std::vector<T>& vec, bool clear_it) if(clear_it) vec.clear(); - while(more_items()) + BER_Decoder list = start_cons(SEQUENCE); + + while(list.more_items()) { T value; - decode(value); + list.decode(value); vec.push_back(value); } + + list.end_cons(); + return (*this); } |