#33192 [Fbk->Opn]: 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 22:35:52 +0000 |
| Subject: | #33192 [Fbk->Opn]: failure to pass certificate in handshake of openssl related transport sockets | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-79773@lists.php.net to get a copy of this message | ||
ID: 33192
User updated by: justin dot d dot allen at gmail dot com
Reported By: justin dot d dot allen at gmail dot com
-Status: Feedback
+Status: Open
Bug Type: Sockets related
Operating System: linux(slackware)
-PHP Version: 5.0.3
+PHP Version: 5.0.4(latest snapshot)
New Comment:
installed php5-latest.tar.gz
am now getting the same error from server
but error from client is the same SSL error with added warnings
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 ssl.conector.php on line 17
Warning: stream_socket_client(): Failed to enable crypto in
ssl.conector.php on line 17
Warning: stream_socket_client(): unable to connect to tls://host:port
(Unknown error) in ssl.conector.php on line 17
(0)<br />
still no certificate passed
stream_socket_enable_crypto makes no difference
Previous Comments:
------------------------------------------------------------------------
[2005-05-31 07:22:24] sniper@php.net
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
------------------------------------------------------------------------
[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