aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2015-07-06 20:48:43 +0200
committerSimon Warta <[email protected]>2015-07-07 11:01:05 +0200
commit5d82a637f8fc4f14c672b297de876276cabcc627 (patch)
tree5a219b7bef9c0fae94306704835d3217e78a8761 /src
parentd45581efad59f9707708893131237aff5471a9fd (diff)
Fix to_string for BER_Object when debug STL is used
Diffstat (limited to 'src')
-rw-r--r--src/lib/asn1/asn1_obj.cpp4
-rw-r--r--src/lib/utils/stl_util.h7
2 files changed, 9 insertions, 2 deletions
diff --git a/src/lib/asn1/asn1_obj.cpp b/src/lib/asn1/asn1_obj.cpp
index 265668d83..20555e3dd 100644
--- a/src/lib/asn1/asn1_obj.cpp
+++ b/src/lib/asn1/asn1_obj.cpp
@@ -10,6 +10,7 @@
#include <botan/ber_dec.h>
#include <botan/data_src.h>
#include <botan/parsing.h>
+#include <botan/internal/stl_util.h>
namespace Botan {
@@ -45,8 +46,7 @@ std::vector<byte> put_in_sequence(const std::vector<byte>& contents)
*/
std::string to_string(const BER_Object& obj)
{
- return std::string(reinterpret_cast<const char*>(&obj.value[0]),
- obj.value.size());
+ return to_string(obj.value);
}
/*
diff --git a/src/lib/utils/stl_util.h b/src/lib/utils/stl_util.h
index 76cf77ef8..d74cbe713 100644
--- a/src/lib/utils/stl_util.h
+++ b/src/lib/utils/stl_util.h
@@ -1,6 +1,7 @@
/*
* STL Utility Functions
* (C) 1999-2007 Jack Lloyd
+* (C) 2015 Simon Warta (Kullo GmbH)
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
@@ -11,6 +12,7 @@
#include <vector>
#include <string>
#include <map>
+#include <botan/secmem.h>
namespace Botan {
@@ -19,6 +21,11 @@ inline std::vector<byte> to_byte_vector(const std::string& s)
return std::vector<byte>(s.cbegin(), s.cend());
}
+inline std::string to_string(const secure_vector<byte> &bytes)
+ {
+ return std::string(bytes.cbegin(), bytes.cend());
+ }
+
/*
* Searching through a std::map
* @param mapping the map to search