aboutsummaryrefslogtreecommitdiffstats
path: root/src/asn1_int.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-05-19 00:07:25 +0000
committerlloyd <[email protected]>2006-05-19 00:07:25 +0000
commitf090e030be53e574fecbe7cf50edfb5fdacb53e1 (patch)
tree0bff0c249a9dbcb674fcd2491ab17e3d123ef1f9 /src/asn1_int.cpp
parenta0af7b26591f8fb79d1f06fe42548e1eb0c35e90 (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.cpp20
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;
}
/*************************************************