aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/cert/cvc/asn1_eac_tm.cpp14
-rw-r--r--src/lib/cert/x509/x509_obj.cpp2
2 files changed, 10 insertions, 6 deletions
diff --git a/src/lib/cert/cvc/asn1_eac_tm.cpp b/src/lib/cert/cvc/asn1_eac_tm.cpp
index 6aad1067c..83a6ef391 100644
--- a/src/lib/cert/cvc/asn1_eac_tm.cpp
+++ b/src/lib/cert/cvc/asn1_eac_tm.cpp
@@ -13,6 +13,8 @@
#include <botan/parsing.h>
#include <botan/internal/rounding.h>
#include <botan/calendar.h>
+#include <sstream>
+#include <iomanip>
namespace Botan {
@@ -153,11 +155,13 @@ std::string EAC_Time::readable_string() const
if(time_is_set() == false)
throw Invalid_State("EAC_Time::readable_string: No time set");
- std::string output(11, 0);
-
- std::sprintf(&output[0], "%04d/%02d/%02d", year, month, day);
-
- return output;
+ // desired format: "%04d/%02d/%02d"
+ std::stringstream output;
+ output << std::setfill('0')
+ << std::setw(4) << year << "/"
+ << std::setw(2) << month << "/"
+ << std::setw(2) << day;
+ return output.str();
}
/*
diff --git a/src/lib/cert/x509/x509_obj.cpp b/src/lib/cert/x509/x509_obj.cpp
index 71449098e..0f5999b5b 100644
--- a/src/lib/cert/x509/x509_obj.cpp
+++ b/src/lib/cert/x509/x509_obj.cpp
@@ -39,7 +39,7 @@ X509_Object::X509_Object(const std::string& file, const std::string& labels)
*/
X509_Object::X509_Object(const std::vector<byte>& vec, const std::string& labels)
{
- DataSource_Memory stream(&vec[0], vec.size());
+ DataSource_Memory stream(vec.data(), vec.size());
init(stream, labels);
}