aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/cert/cvc
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2015-06-26 11:18:01 +0200
committerSimon Warta <[email protected]>2015-06-27 11:15:12 +0200
commit922336151782c42455d08cca787215b0a4e7b617 (patch)
treec8370e154689d22133d5c87c7d08fa185f7c5dd6 /src/lib/cert/cvc
parentacb8254284f6251291e4ae25ee5e3ee6302d3029 (diff)
lib/cert: Convert &vec[0] to vec.data()
Diffstat (limited to 'src/lib/cert/cvc')
-rw-r--r--src/lib/cert/cvc/asn1_eac_tm.cpp14
1 files changed, 9 insertions, 5 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();
}
/*