From: n_sergiu at hotmail dot com
Operating system: all
PHP version: 4.3.4
PHP Bug Type: OpenSSL related
Bug description: the openssl_x509_parse function does not extract the certificate
extensions
Description:
------------
When I use the openssl_x509_parse to parse a x509 certificate, the v3
extensions are not included in the output result.
Reproduce code:
---------------
$file = fopen("/home/sergiu/clienttest.crt", "rb");
$cert = fread($file, filesize("/home/sergiu/clienttest.crt"));
print_r(openssl_x509_parse($cert));
Expected result:
----------------
Array
(
[name] => /C=RO/ST=Romania/L=Craiova/O=XXX/OU=Mobile/CN=teste extens
[subject] => Array
(
[C] => RO
[ST] => Romania
[L] => Craiova
[O] => Sergiu Software
[OU] => Mobile
[CN] => teste extens
)
[hash] => 33df1a8c
[issuer] => Array
(
[C] => RO
[ST] => Romania
[O] => Sergiu Software
[CN] => Sergiu Software CA
)
[version] => 2
[serialNumber] => 38
[validFrom] => 030712124551Z
[validTo] => 040711124551Z
[validFrom_time_t] => 1058013951
[validTo_time_t] => 1089549951
[purposes] => Array
(
[1] => Array
(
[0] => 1
[1] =>
[2] => sslclient
)
[2] => Array
(
[0] => 1
[1] =>
[2] => sslserver
)
[3] => Array
(
[0] => 1
[1] =>
[2] => nssslserver
)
[4] => Array
(
[0] => 1
[1] =>
[2] => smimesign
)
[5] => Array
(
[0] => 1
[1] =>
[2] => smimeencrypt
)
[6] => Array
(
[0] =>
[1] =>
[2] => crlsign
)
[7] => Array
(
[0] => 1
[1] => 1
[2] => any
)
)
[v3extensions] => Array
(
[1] => Array
(
[0] => NetscapeComment
[1] => 1
[2] => For Grid use only; request tag userTag
)
...........................
)
)
Actual result:
--------------
Array
(
[name] => /C=RO/ST=Romania/L=Craiova/O=XXX/OU=Mobile/CN=teste extens
[subject] => Array
(
[C] => RO
[ST] => Romania
[L] => Craiova
[O] => Sergiu Software
[OU] => Mobile
[CN] => teste extens
)
[hash] => 33df1a8c
[issuer] => Array
(
[C] => RO
[ST] => Romania
[O] => Sergiu Software
[CN] => Sergiu Software CA
)
[version] => 2
[serialNumber] => 38
[validFrom] => 030712124551Z
[validTo] => 040711124551Z
[validFrom_time_t] => 1058013951
[validTo_time_t] => 1089549951
[purposes] => Array
(
[1] => Array
(
[0] => 1
[1] =>
[2] => sslclient
)
[2] => Array
(
[0] => 1
[1] =>
[2] => sslserver
)
[3] => Array
(
[0] => 1
[1] =>
[2] => nssslserver
)
[4] => Array
(
[0] => 1
[1] =>
[2] => smimesign
)
[5] => Array
(
[0] => 1
[1] =>
[2] => smimeencrypt
)
[6] => Array
(
[0] =>
[1] =>
[2] => crlsign
)
[7] => Array
(
[0] => 1
[1] => 1
[2] => any
)
)
)
--
Edit bug report at http://bugs.php.net/?id=28382&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28382&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28382&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=28382&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=28382&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=28382&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=28382&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=28382&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=28382&r=support
Expected behavior: http://bugs.php.net/fix.php?id=28382&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=28382&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=28382&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=28382&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28382&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=28382&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=28382&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=28382&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28382&r=float