mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
LibTLS: ASN1 parse_utc_time handle pre 2000 years
In this format the year is specified using two digits. In the case that these digits are 50 or more, we should assume that the year is in 1950-1999. If it is 49 or less, the year is 2000-2049. This is specified in RFC5280 section 4.1.2.5.1.
This commit is contained in:
committed by
Ali Mohammad Pur
parent
fea5aeda0b
commit
f8ce0eb648
@@ -110,7 +110,9 @@ Optional<Core::DateTime> parse_utc_time(StringView time)
|
||||
return {};
|
||||
}
|
||||
|
||||
auto full_year = (Core::DateTime::now().year() / 100) * 100 + year_in_century.value();
|
||||
// RFC5280 section 4.1.2.5.1.
|
||||
auto full_year = year_in_century.value();
|
||||
full_year += (full_year < 50) ? 2000 : 1900;
|
||||
auto full_seconds = seconds.value_or(0);
|
||||
|
||||
// FIXME: Handle offsets!
|
||||
|
||||
Reference in New Issue
Block a user