From 8d34cb11e944068c9e3ba13a8c50d6eab4af7c01 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sun, 5 Aug 2012 10:55:47 -0500 Subject: [PATCH] - validateDate didn't work --- phpseclib/File/X509.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/phpseclib/File/X509.php b/phpseclib/File/X509.php index b42da814..a249c7d9 100644 --- a/phpseclib/File/X509.php +++ b/phpseclib/File/X509.php @@ -1556,9 +1556,19 @@ class File_X509 { $date = time(); } + $notBefore = $this->currentCert['tbsCertificate']['validity']['notBefore']['generalTime']; + if (!isset($notBefore)) { + $notBefore = $this->currentCert['tbsCertificate']['validity']['notBefore']['utcTime']; + } + + $notAfter = $this->currentCert['tbsCertificate']['validity']['notAfter']['generalTime']; + if (!isset($notAfter)) { + $notAfter = $this->currentCert['tbsCertificate']['validity']['notAfter']['utcTime']; + } + switch (true) { - case time() < @strtotime($this->currentCert['tbsCertificate']['validity']['notBefore']): - case time() > @strtotime($this->currentCert['tbsCertificate']['validity']['notAfter']): + case $date < @strtotime($notBefore): + case $date > @strtotime($notAfter): return false; }