ID: 33192 Updated by: [EMAIL PROTECTED] Reported By: justin dot d dot allen at gmail dot com -Status: Open +Status: Feedback Bug Type: Sockets related Operating System: linux(slackware) PHP Version: 5.0.3 New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip stream_socket_enable_crypto() was added in PHP 5.1-dev, it's not (and will not be) in PHP 5.0.x Previous Comments: ------------------------------------------------------------------------ [2005-05-31 05:36:42] justin dot d dot allen at gmail dot com line that was truncated on exapmle source is if (!fp = stream_sockect_client("tls://host:port",$errno,$errstr,30,STREAM_CLIENT_CONNECT/*|STREAM_CLIENT_ASYNC_CONNECT*/,$fc)) { ------------------------------------------------------------------------ [2005-05-31 03:36:49] justin dot d dot allen at gmail dot com 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 this bug report at http://bugs.php.net/?id=33192&edit=1