mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-17 10:45:11 +00:00
X509: fix errors with validateDate
This commit is contained in:
parent
ec7454dd78
commit
476cb127b1
@ -2111,17 +2111,16 @@ class X509
|
||||
$notAfter = $this->currentCert['tbsCertificate']['validity']['notAfter'];
|
||||
$notAfter = isset($notAfter['generalTime']) ? $notAfter['generalTime'] : $notAfter['utcTime'];
|
||||
|
||||
switch (true) {
|
||||
case is_string($date):
|
||||
$date = new DateTime($date, new DateTimeZone(@date_default_timezone_get()));
|
||||
default:
|
||||
$notBefore = new DateTime($notBefore, new DateTimeZone(@date_default_timezone_get()));
|
||||
$notAfter = new DateTime($notAfter, new DateTimeZone(@date_default_timezone_get()));
|
||||
if (is_string($date)) {
|
||||
$date = new DateTime($date, new DateTimeZone(@date_default_timezone_get()));
|
||||
}
|
||||
|
||||
$notBefore = new DateTime($notBefore, new DateTimeZone(@date_default_timezone_get()));
|
||||
$notAfter = new DateTime($notAfter, new DateTimeZone(@date_default_timezone_get()));
|
||||
|
||||
switch (true) {
|
||||
case $date < new DateTime($notBefore, new DateTimeZone(@date_default_timezone_get())):
|
||||
case $date > new DateTime($notAfter, new DateTimeZone(@date_default_timezone_get())):
|
||||
case $date < $notBefore:
|
||||
case $date > $notAfter:
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user