# HG changeset patch # User František Kučera # Date 1625957055 -7200 # Node ID c232d8b8efbf6459bf1b6dda562a071ac64762fe # Parent fade2f562970ef71b8e607b2a84f4fe4986d1de4 UTCTime and GeneralizedTime clean-up and comment diff -r fade2f562970 -r c232d8b8efbf src/lib/BasicASN1Reader.h --- a/src/lib/BasicASN1Reader.h Mon Jul 05 19:31:25 2021 +0200 +++ b/src/lib/BasicASN1Reader.h Sun Jul 11 00:44:15 2021 +0200 @@ -195,14 +195,7 @@ ASN1ContentHandler::DateTime dateTime; std::smatch match; - 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})'?)"))) { - // Supported UTCTime formats: - // YYMMDDhhmmZ - // YYMMDDhhmmssZ - // YYMMDDhhmm+hhmm - // YYMMDDhhmm-hhmm - // YYMMDDhhmmss+hhmm - // YYMMDDhhmmss-hhmm + 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}))"))) { int i = 1; uint32_t year = std::stoi(match[i++]); dateTime.year = year < 50 ? 2000 + year : 1900 + year; @@ -231,7 +224,8 @@ ASN1ContentHandler::DateTime dateTime; std::smatch match; - 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})'?)"))) { + 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}))"))) { + // TODO: support also fractions of minutes and hours in GeneralizedTime int i = 1; dateTime.year = std::stoi(match[i++]); dateTime.month = std::stoi(match[i++]);