26 #include "../../util/time.hpp" 28 #include <boost/format.hpp> 29 #include <boost/lexical_cast.hpp> 42 BOOST_ASSERT(str.size() >= 15);
43 std::string asn1time = str.substr(0, 8) + str.substr(9,6) +
"Z";
45 bt.Put(GENERALIZED_TIME);
46 size_t lengthBytes = DERLengthEncode(bt, asn1time.size());
47 bt.Put(reinterpret_cast<const uint8_t*>(asn1time.c_str()), asn1time.size());
48 return 1+lengthBytes+asn1time.size();
56 if (!bt.Get(b) || (b != GENERALIZED_TIME && b != UTC_TIME))
60 if (!BERLengthDecode(bt, bc))
63 SecByteBlock time_str(bc);
64 if (bc != bt.Get(time_str, bc))
68 str.assign (time_str.begin(), time_str.end());
71 if (boost::lexical_cast<int>(str.substr(0,2)) < 50)
Copyright (c) 2011-2015 Regents of the University of California.
system_clock::TimePoint fromIsoString(const std::string &isoString)
Convert from the ISO string (YYYYMMDDTHHMMSS,fffffffff) representation to the internal time format...
Copyright (c) 2013-2016 Regents of the University of California.
size_t DEREncodeGeneralTime(CryptoPP::BufferedTransformation &bt, const time::system_clock::TimePoint &time)
void BERDecodeTime(CryptoPP::BufferedTransformation &bt, time::system_clock::TimePoint &time)
std::string toIsoString(const system_clock::TimePoint &timePoint)
Convert to the ISO string representation of the time (YYYYMMDDTHHMMSS,fffffffff)