Re: PHP stream_socket_client OpenSSL error (unknown ca)
| From: | Richard | Date: | Tue, 19 Oct 2010 18:46:43 +0000 |
| Subject: | Re: PHP stream_socket_client OpenSSL error (unknown ca) | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-308852@lists.php.net to get a copy of this message | ||
No I didn't have a passphrase on the local cert when I created it.
I noticed that I only sent it to you and then sent the same message to the list.
Thank you,
Richard
Le 19/10/10 20:28, Tommy Pham a écrit :
-----Original Message----- From: Richard [mailto:php_list@ghz.fr] Sent: Tuesday, October 19, 2010 11:22 AM To: Tommy Pham Subject: Re: [PHP] PHP stream_socket_client OpenSSL error (unknown ca) I left the pasphrase blank, I've just tried with a blank passphrase butitdoesn't help. <?php'./afnic.pem');$context = stream_context_create(); stream_context_set_option($context, 'ssl', 'local_cert',TRUE);stream_context_set_option($context, 'ssl', 'passphrase', ''); stream_context_set_option($context, 'ssl', 'allow_self_signed',What I meant was that did you have a passphrase on your actual local cert when you created it? PS: Please cc the list also so others would know what's going and can help troubleshoot and not reiterate what've been tried already.stream_context_set_option($context, 'ssl', 'verify_peer', FALSE);$connexion = stream_socket_client('ssl://epp.test.nic.fr:700',$errno, $errstr, 30, STREAM_CLIENT_CONNECT, $context);if($connexion) { print('succes'); }?>Le 19/10/10 20:16, Tommy Pham wrote :$errno,-----Original Message----- From: Richard [mailto:php_list@ghz.fr] Sent: Tuesday, October 19, 2010 10:50 AM To: php-general@lists.php.net Subject: [PHP] PHP stream_socket_client OpenSSL error (unknown ca)'./cert.pem');Hello,I'm having some problems connecting to a server using the following php script : <?php$context = stream_context_create(); stream_context_set_option($context, 'ssl', 'local_cert',TRUE);stream_context_set_option($context, 'ssl', 'allow_self_signed',stream_context_set_option($context, 'ssl', 'verify_peer', FALSE);$ctn = stream_socket_client('ssl://distant.server.com:987',it$errstr,[1].30, STREAM_CLIENT_CONNECT, $context);Just curious, 'passphrase stringif($ctn) { print('Connected !'); }?>Passphrase with which your local_cert file was encoded' quoted fromRegards, Tommy [1] http://us3.php.net/manual/en/context.ssl.phpcert.pem is a self signed certificate that I generated a few days ago,certificatecontains both RSA Key and Certificate and I have supplied thelinestothe distant server. When I launch the script I get the following errors : Warning: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:14094418:SSL routines:SSL3_READ_BYTES:tlsv1 alert unknown ca in /path/to/my/test.php on line 7 As it is a self signed certificate there is no CA so I added the twoor:TRUE);stream_context_set_option($context, 'ssl', 'allow_self_signed',thinkstream_context_set_option($context, 'ssl', 'verify_peer', FALSE);but that did not fix the problem. This is my first script that connects through a socket using SSL, but Ithat it doesn't even get out of the server because it doesn't like the certificate. Do you have any ideas about how I could get this working ?maybe just point me in the right direction. If you need any more infopleaselet me know. Thank you, Richard