diff options
author | lloyd <[email protected]> | 2006-05-19 00:07:25 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-05-19 00:07:25 +0000 |
commit | f090e030be53e574fecbe7cf50edfb5fdacb53e1 (patch) | |
tree | 0bff0c249a9dbcb674fcd2491ab17e3d123ef1f9 /src/asn1_int.cpp | |
parent | a0af7b26591f8fb79d1f06fe42548e1eb0c35e90 (diff) |
Syntax changes to the BER and DER APIs to improve readability of code
that uses them. These changes are not backwards compatible, this commit
updates all uses of the APIs within the library.
Diffstat (limited to 'src/asn1_int.cpp')
-rw-r--r-- | src/asn1_int.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/asn1_int.cpp b/src/asn1_int.cpp index 324187eff..042712df1 100644 --- a/src/asn1_int.cpp +++ b/src/asn1_int.cpp @@ -5,6 +5,7 @@ #include <botan/asn1_int.h> #include <botan/der_enc.h> +#include <botan/ber_dec.h> #include <botan/data_src.h> #include <botan/parsing.h> @@ -30,11 +31,20 @@ namespace ASN1 { *************************************************/ SecureVector<byte> put_in_sequence(const MemoryRegion<byte>& contents) { - DER_Encoder encoder; - encoder.start_sequence(); - encoder.add_raw_octets(contents); - encoder.end_sequence(); - return encoder.get_contents(); + return DER_Encoder() + .start_cons(SEQUENCE) + .raw_bytes(contents) + .end_cons() + .get_contents(); + } + +/************************************************* +* Convert a BER object into a string object * +*************************************************/ +std::string to_string(const BER_Object& obj) + { + std::string str((const char*)obj.value.begin(), obj.value.size()); + return str; } /************************************************* |