RE: Faulty client certificate in PHP
Lucian Daia <[email protected]> Mon, 28 Feb 2011 08:28:18 +0000
| Newsgroups | gmane.comp.web.curl.php |
|---|---|
| Message-ID | <[email protected]> |
Hello! Thanks for the tip, but it didn't work. It seems like the cURL library reads the client certificate, it's just that it doesn't send it over the wire. Also, I need to specify that the cert.pem and wazuremgm.pem certificates I am using are the same. Lucian Date: Mon, 28 Feb 2011 16:02:26 +0800 Subject: Re: Faulty client certificate in PHP From: [email protected] To: [email protected] You may want to try specifying an absolute path to your cert. With regards, Liu Shan Shui http://lx.sg/ "Life would be much easier if I had the source code." - Anonymous On Mon, Feb 28, 2011 at 8:22 AM, Lucian Daia <[email protected]> wrote: Hello! I've been trying for some time to connect to a Windows Azure account that requires a client certificate using PHP, but I keep getting SSL errno 10054, which basically means that the remote host rejected me. Here are some details I can provide: 1) The PHP Script I am using curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_PORT , 443); curl_setopt($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_VERBOSE, '1'); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Host: management.core.windows.net', 'x-ms-version: 2010-04-01')); curl_setopt($ch, CURLOPT_SSLCERT, 'cert.pem'); curl_setopt($ch, CURLOPT_CRLF, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // just on development 2) The curl command line script I am using: curl -k -E wazuremgm.pem --Verbose -H "x-ms-version: 2010-04-01" https://management.core.windows.net/<subscription-id>/90/services/hostedservices The funny thing is that the command line version works, while the PHP counter-part doesn't. I've added Fiddler to the mix to see exactly why it doesn't work and it seems that although both scripts send *exactly* the same data, the PHP version simply hangs when it's time to send the client certificate and the remote host decides to cut the communications channel after a while. Just in case it's necessary, here are the cURL details for my PHP installation: - version 7.21.2 - OpenSSL version 0.9.8l - Zlib 1.2.3 - libSSH 2/1.2.7 And for the command-line tool: - version 7.21.4 - OpenSSL version 0.9.8r - Zlib 1.2.5 - libSSH 2/1.2.7 My operation system is Windows Vista and PHP version is 5.3.3 / 5.3.5 (doesn't work on any of them). The certificate was converted correctly and it's a .pem with both the certificate and private key segments in the same file. It's obviously not a certificate problem, since the command-line version works just fine with it. If I can provide you with any more details, I'd be glad to! Thanks, Lucian _______________________________________________ http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php _______________________________________________ http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php _______________________________________________ http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php