mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-23 01:49:53 +03:00
src/Mayaqua/Encrypt.c: Add support for certificates with full year
This commit is contained in:
parent
1e8cf1dc5d
commit
3d0e87cf57
@ -2134,6 +2134,9 @@ bool Asn1TimeToSystem(SYSTEMTIME *s, void *asn1_time)
|
||||
// Convert the string to the system time
|
||||
bool StrToSystem(SYSTEMTIME *s, char *str)
|
||||
{
|
||||
char century[3] = {0, 0, 0};
|
||||
bool fourdigityear = false;
|
||||
|
||||
// Validate arguments
|
||||
if (s == NULL || str == NULL)
|
||||
{
|
||||
@ -2141,7 +2144,14 @@ bool StrToSystem(SYSTEMTIME *s, char *str)
|
||||
}
|
||||
if (StrLen(str) != 13)
|
||||
{
|
||||
return false;
|
||||
if (StrLen(str) != 15) return false;
|
||||
|
||||
//Year has 4 digits - save first two and use the rest
|
||||
//as if it had two digits
|
||||
fourdigityear = true;
|
||||
century[0] = str[0];
|
||||
century[1] = str[1];
|
||||
str += 2;
|
||||
}
|
||||
if (str[12] != 'Z')
|
||||
{
|
||||
@ -2158,7 +2168,10 @@ bool StrToSystem(SYSTEMTIME *s, char *str)
|
||||
second[3] = {str[10], str[11], 0};
|
||||
Zero(s, sizeof(SYSTEMTIME));
|
||||
s->wYear = ToInt(year);
|
||||
if (s->wYear >= 60)
|
||||
if( fourdigityear ) {
|
||||
s->wYear += ToInt(century) * 100;
|
||||
}
|
||||
else if (s->wYear >= 60)
|
||||
{
|
||||
s->wYear += 1900;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user