#33192 [NEW]: failure to pass certificate in handshake of openssl related transport sockets
| From: | justin dot d dot allen at gmail dot com | Date: | Tue, 31 May 2005 01:36:50 +0000 |
| Subject: | #33192 [NEW]: failure to pass certificate in handshake of openssl related transport sockets | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-79734@lists.php.net to get a copy of this message | ||
From: justin dot d dot allen at gmail dot com
Operating system: linux(slackware)
PHP version: 5.0.3
PHP Bug Type: Sockets related
Bug description: failure to pass certificate in handshake of openssl related transport sockets
Description:
------------
Have been unable to get a socket_stream_client() to pass the certificate
whose path is specified by stream_context_create().
also stream_socket_enable_crypto() is an unknown function.
Reproduce code:
---------------
<?php
ini_set("display_errors",1);
$fc = stream_context_create(array(
'tls'=>array(
'passphrase'=>'*******',
'allow_self_signed'=>'TRUE',
'local_cert'=>'sec.pem'
)
));
if (!$fp =
stream_socket_client("tls://host:port",$errno,$errstr,30,STREAM_CLIENT_CONNECT/*|STREAM_CLIENT_ASYNC_CONNE$
echo "$errstr ($errno)<br />\n";
} else {
//stream_socket_enable_crypto($fp,true,STREAM_SOCKET_CRYPTO_METHOD_TLS_CLIENT);
sleep(30);
}
?>
Expected result:
----------------
expect to get successful connection to my ssl server software and it waits
for a command until sleep is complete
the sec.pem file is the result of cat cert.pem pk.pem
this may not be the specified file format(if so docs weren't clear
enough for me)
I am able to connect to my server using
openssl s_client -connect host:port -cert cert.pem -key pk.pem
successfully
Actual result:
--------------
from the php connector I recieve
Warning: stream_socket_client(): SSL operation failed with code 1. OpenSSL
Error messages:
error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure
in /home/ebay/test/ssl.conector.php on line 17
from the server(which for debugging is openssl s_server -accept port -cert
cert.pem -key pk.pem -Verify 1) I recieve
19447:error:140890C7:SSL routines:SSL3_GET_CLIENT_CERTIFICATE:peer did not
return a certificate:s3_srvr.c:2004:
get same result from custom server
the commented out stream_socket_enable_crypto call gives me
Fatal error: Call to undefined function stream_socket_enable_crypto() in
/home/ebay/test/ssl.conector.php on line 20
which I imagine is the problem
--
Edit bug report at http://bugs.php.net/?id=33192&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33192&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33192&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33192&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33192&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33192&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33192&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33192&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33192&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33192&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33192&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=33192&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=33192&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33192&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33192&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33192&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33192&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33192&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33192&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33192&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33192&r=mysqlcfg