Bug #66636 [NEW]: openssl_x509_parse warning with V_ASN1_GENERALIZEDTIME

From: Date: Mon, 03 Feb 2014 15:48:05 +0000
Subject: Bug #66636 [NEW]: openssl_x509_parse warning with V_ASN1_GENERALIZEDTIME
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-184133@lists.php.net to get a copy of this message
From:             jcarter at meruetnworks dot com
Operating system: Linux
PHP version:      5.4.24
Package:          OpenSSL related
Bug Type:         Bug
Bug description:openssl_x509_parse warning with V_ASN1_GENERALIZEDTIME

Description:
------------
This cert in the test script causes openssl_x509_parse() to give a
warning "illegal ASN1 data type for timestamp". 

The cert was generated by a Windows 2003 server. Note the "valid to"
time is "Jun 21 15:59:11 2109 GMT". In openssl.c PHP checks for
V_ASN1_UTCTIME, but triggers the warning when the time is
V_ASN1_GENERALIZEDTIME. According to a brief search of the openssl
source both are valid expressions of a valid from/to time.

We're aware this time is past the unix epoch, suggest any fix continues
to set validTo_time_t to -1 in this situation.

Thanks, John


Test script:
---------------
<?php

$cert = '-----BEGIN CERTIFICATE-----
MIIDiTCCAnGgAwIBAgIQTp32u93Rer1JSevmObIqPjANBgkqhkiG9w0BAQUFADBW
MRMwEQYKCZImiZPyLGQBGRYDY29tMSAwHgYKCZImiZPyLGQBGRYQaWRlbnRpdHlu
ZXR3b3JrczEdMBsGA1UEAxMUaWRlbnRpdHluZXR3b3Jrcy5jb20wIBcNMTAwNjIx
MTU0OTEzWhgPMjEwOTA2MjExNTU5MTFaMFYxEzARBgoJkiaJk/IsZAEZFgNjb20x
IDAeBgoJkiaJk/IsZAEZFhBpZGVudGl0eW5ldHdvcmtzMR0wGwYDVQQDExRpZGVu
dGl0eW5ldHdvcmtzLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
AL1lcawnrOiH8Zmkk1KqX8L1HNoUuImYpi+ILX32mOO3lwKi2+1uwN9c6Gtuj8Iq
G5wPfDG9kDWCVV1YqdXVJpr1yZsMcZMtHplsOaEmYmJ1icJfWqy4fHYG945rdZEU
Nk+yxBo6/CkaBKFDw9WRLswBOaFxIPu2hTRpsaFGiFYtTMVhvKv85sE4vX22w1DZ
C4/UuxGSo5g3CNX5pA68YCA+kQAvhupX4BHINHuWItquf9vFE6Fm5byFRHiJFqZo
NNioWIi+Y67jJqBl+YOhPE3KuhZhdgi/Hm2/oB6RjVWJdlIDN2iTPaeikIAOahO6
lMt7uDDclrS/3AqpftHtDw0CAwEAAaNRME8wCwYDVR0PBAQDAgGGMA8GA1UdEwEB
/wQFMAMBAf8wHQYDVR0OBBYEFHDmc20i3LpNg4II9MDNShE49KakMBAGCSsGAQQB
gjcVAQQDAgEAMA0GCSqGSIb3DQEBBQUAA4IBAQBUNxuWYVF9sSRcu1vOG4Glhx1e
bNeUlvonMnYQvRbyh36+wD2Z2SCAhSwjzsI7JyXl9b4VONmkxKFoOyGrhSSgNfF8
+u9ZTTsB6J1C1IEcR0xvS8RJpmBkwXS08Dek91K9vIPFzVuq+tk5+YCUX704PMqJ
zpzATZPEokssc8si5onSjQT2TqoD/YcVQq8QgcRwVPAtUiFkmjfMtiHancu2DraK
hwxG2/YZ+ONUo9kpxvdMZwesj8frbyjojKqVeDTI1uJlhieFYulgI0+UNOabnKej
M+MUp3IKiKAN4mfxi4+/Wyllzq+xXLVrVqMXpD9q7RfOawBIW3TRNfU5rqb+
-----END CERTIFICATE-----';

$a = openssl_x509_parse($cert, false);


Expected result:
----------------
No error

Actual result:
--------------
Warning: openssl_x509_parse(): illegal ASN1 data type for timestamp in
/root/bad.php on line 27


-- 
Edit bug report at https://bugs.php.net/bug.php?id=66636&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=66636&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=66636&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=66636&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=66636&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=66636&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=66636&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=66636&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=66636&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=66636&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=66636&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=66636&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=66636&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=66636&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66636&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=66636&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=66636&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=66636&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66636&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=66636&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=66636&r=mysqlcfg



Thread (4 messages)

« previous php.bugs (#184133) next »