--- 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++]);