From: tokul at users dot sourceforge dot net
Operating system: Linux Debian Etch
PHP version: 5CVS-2007-10-08 (snap)
PHP Bug Type: OpenSSL related
Bug description: openssl_x509_checkpurpose returns int(0) on valid public
certificate
Description:
------------
According to last chapter in openssl_x509_checkpurpose() manual function
should return true, false or int(-1). Synopsis line shows that function
returns integer.
If I check public certificate file with OpenSSL binary (openssl x509
-purpose -in certfile.pem), it shows purposes as
----
SSL client : Yes
SSL client CA : No
SSL server : Yes
SSL server CA : No
Netscape SSL server : Yes
Netscape SSL server CA : No
S/MIME signing : Yes
S/MIME signing CA : No
S/MIME encryption : Yes
S/MIME encryption CA : No
CRL signing : Yes
CRL signing CA : No
Any Purpose : Yes
Any Purpose CA : Yes
OCSP helper : Yes
OCSP helper CA : No
----
If I check it with PHP
----
var_dump(openssl_x509_checkpurpose(file_get_contents('./certfile.pem'),X509_PURPOSE_SMIME_SIGN));
---
it returns int(0). Int(0) is evaluated as boolean false in PHP.
Tested PHP 5.2.0 and PHP 5.2-dev (200710080830). OpenSSL 0.9.8c (Debian
0.9.8c-4 package). Used Thawte free email certificate for testing.
Certificate is valid from 2007.02.24 till 2008.02.24. System clock is
correct.
Reproduce code:
---------------
var_dump(openssl_x509_checkpurpose(file_get_contents('./certfile.pem'),X509_PURPOSE_SMIME_SIGN));
Expected result:
----------------
bool(true) or int(1)
Actual result:
--------------
int(0)
--
Edit bug report at http://bugs.php.net/?id=42886&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=42886&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=42886&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=42886&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42886&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=42886&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42886&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42886&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42886&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42886&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42886&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=42886&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=42886&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42886&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42886&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42886&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42886&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42886&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42886&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42886&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42886&r=mysqlcfg