equal
deleted
inserted
replaced
193 read((uint8_t*) s.data(), typeHeader.length); |
193 read((uint8_t*) s.data(), typeHeader.length); |
194 |
194 |
195 ASN1ContentHandler::DateTime dateTime; |
195 ASN1ContentHandler::DateTime dateTime; |
196 |
196 |
197 std::smatch match; |
197 std::smatch match; |
198 if (std::regex_match(s, match, std::regex("([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})?(Z|([+-][0-9]{2})'?([0-9]{2})'?)"))) { |
198 if (std::regex_match(s, match, std::regex("([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})?(Z|([+-][0-9]{2})([0-9]{2}))"))) { |
199 // Supported UTCTime formats: |
|
200 // YYMMDDhhmmZ |
|
201 // YYMMDDhhmmssZ |
|
202 // YYMMDDhhmm+hhmm |
|
203 // YYMMDDhhmm-hhmm |
|
204 // YYMMDDhhmmss+hhmm |
|
205 // YYMMDDhhmmss-hhmm |
|
206 int i = 1; |
199 int i = 1; |
207 uint32_t year = std::stoi(match[i++]); |
200 uint32_t year = std::stoi(match[i++]); |
208 dateTime.year = year < 50 ? 2000 + year : 1900 + year; |
201 dateTime.year = year < 50 ? 2000 + year : 1900 + year; |
209 dateTime.month = std::stoi(match[i++]); |
202 dateTime.month = std::stoi(match[i++]); |
210 dateTime.day = std::stoi(match[i++]); |
203 dateTime.day = std::stoi(match[i++]); |
229 read((uint8_t*) s.data(), typeHeader.length); |
222 read((uint8_t*) s.data(), typeHeader.length); |
230 |
223 |
231 ASN1ContentHandler::DateTime dateTime; |
224 ASN1ContentHandler::DateTime dateTime; |
232 |
225 |
233 std::smatch match; |
226 std::smatch match; |
234 if (std::regex_match(s, match, std::regex("([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})(\\.([0-9]{1,3}))?(Z|([+-][0-9]{2})'?([0-9]{2})'?)"))) { |
227 if (std::regex_match(s, match, std::regex("([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})(\\.([0-9]{1,3}))?(Z|([+-][0-9]{2})([0-9]{2}))"))) { |
|
228 // TODO: support also fractions of minutes and hours in GeneralizedTime |
235 int i = 1; |
229 int i = 1; |
236 dateTime.year = std::stoi(match[i++]); |
230 dateTime.year = std::stoi(match[i++]); |
237 dateTime.month = std::stoi(match[i++]); |
231 dateTime.month = std::stoi(match[i++]); |
238 dateTime.day = std::stoi(match[i++]); |
232 dateTime.day = std::stoi(match[i++]); |
239 dateTime.hour = std::stoi(match[i++]); |
233 dateTime.hour = std::stoi(match[i++]); |