cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

RE: curl-and-php Digest, Vol 2, Issue 9

From: Xin <xzheng_at_asteriasgi.com>
Date: Fri, 28 Oct 2005 09:32:27 -0500

Thanks, I got it.

Comment out all CURLOPT_CAINFO settings. Use

curl_setopt($ch, CURLOPT_SSLCERT,'c:\certificate.pem');

it's said that curl only accepts .pem files

-----Original Message-----
From: curl-and-php-bounces_at_cool.haxx.se
[mailto:curl-and-php-bounces_at_cool.haxx.se] On Behalf Of
curl-and-php-request_at_cool.haxx.se
Sent: Friday, October 28, 2005 5:00 AM
To: curl-and-php_at_cool.haxx.se
Subject: curl-and-php Digest, Vol 2, Issue 9

Send curl-and-php mailing list submissions to
        curl-and-php_at_cool.haxx.se

To subscribe or unsubscribe via the World Wide Web, visit
        http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
or, via email, send a message with subject or body 'help' to
        curl-and-php-request_at_cool.haxx.se

You can reach the person managing the list at
        curl-and-php-owner_at_cool.haxx.se

When replying, please edit your Subject line so it is more specific
than "Re: Contents of curl-and-php digest..."

Today's Topics:

   1. curl: (58) unable to set certificate file (wrong password?) (Xin)
   2. Re: curl: (58) unable to set certificate file (wrong
      password?) (Daniel Stenberg)
   3. cURL and Foxserv (LOL TOM)

----------------------------------------------------------------------

Message: 1
Date: Thu, 27 Oct 2005 12:01:06 -0500
From: "Xin" <xzheng_at_asteriasgi.com>
Subject: curl: (58) unable to set certificate file (wrong password?)
To: <curl-and-php_at_cool.haxx.se>
Message-ID: <200510271701.j9RH1DHM007778_at_labb.contactor.se>
Content-Type: text/plain; charset="us-ascii"

Hi,

I am new to PHP and curl. I have a problem that has fried me for a week.

I am the client side of a SOAP service. I got the certificate from the
server and I need to access the service using this certificate/key. I am
working on Windows XP. The following code doesn't work. The Error is:

58 - unable to set certificate file (wrong password?)

I gave the multiple settings below for testing. None of them worked.

Any help is greatly appreciated!

================

$url="https://..../postal.asmx?WSDL";
$ch = curl_init($url);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

#curl_setopt($ch, CURLOPT_CAINFO, 'c:\curl-7.15.0\lib\ca-bundle.crt');
#curl_setopt($ch, CURLOPT_CAINFO, 'c:\certificate.pem');
#curl_setopt($ch, CURLOPT_CAINFO,'c:\certnew.cer');
#curl_setopt($ch, CURLOPT_CAINFO,'c:\exportedcertificate.pfx');
#curl_setopt($ch, CURLOPT_CAINFO,'c:\server.keystore');

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSLCERT,'c:\certnew.cer');
#curl_setopt($ch, CURLOPT_SSLCERT,'c:\certificate.pem');
#curl_setopt($ch, CURLOPT_SSLCERT,'c:\exportedcertificate.pfx');
#curl_setopt($ch, CURLOPT_SSLCERT,'c:\server.keystore');

curl_setopt($ch, CURLOPT_SSLCERTPASSWD,'mypw');

##curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);

$returned = curl_exec($ch);
echo $returned;

if ($returned == NULL) {
  echo "Error:";
  echo curl_errno($ch) . " - " . curl_error($ch) . "";
}

curl_close ($ch);

==============================

Thanks a lot in advance
Cynthia

------------------------------

Message: 2
Date: Fri, 28 Oct 2005 00:12:23 +0200 (CEST)
From: Daniel Stenberg <daniel_at_haxx.se>
Subject: Re: curl: (58) unable to set certificate file (wrong
        password?)
To: curl with PHP <curl-and-php_at_cool.haxx.se>
Message-ID: <Pine.LNX.4.63.0510280006530.15302_at_yvahk3.pbagnpgbe.fr>
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed

On Thu, 27 Oct 2005, Xin wrote:

> 58 - unable to set certificate file (wrong password?)
>
> I gave the multiple settings below for testing. None of them worked.

certificate here means client certificate.

> curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
> curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
>
> #curl_setopt($ch, CURLOPT_CAINFO, 'c:\curl-7.15.0\lib\ca-bundle.crt');
> #curl_setopt($ch, CURLOPT_CAINFO, 'c:\certificate.pem');
> #curl_setopt($ch, CURLOPT_CAINFO,'c:\certnew.cer');
> #curl_setopt($ch, CURLOPT_CAINFO,'c:\exportedcertificate.pfx');
> #curl_setopt($ch, CURLOPT_CAINFO,'c:\server.keystore');
>
> curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

None of the options above concerns client certificates.

> curl_setopt($ch, CURLOPT_SSLCERT,'c:\certnew.cer');
> #curl_setopt($ch, CURLOPT_SSLCERT,'c:\certificate.pem');
> #curl_setopt($ch, CURLOPT_SSLCERT,'c:\exportedcertificate.pfx');
> #curl_setopt($ch, CURLOPT_SSLCERT,'c:\server.keystore');
>
> curl_setopt($ch, CURLOPT_SSLCERTPASSWD,'mypw');

I'm not an expert on this, but I think you need a private key as well when
using a cert.

Allow me to quote the curl_easy_setopt man page for CURLOPT_SSLCERTPASSWD:

       This option is replaced by CURLOPT_SSLKEYPASSWD and should only
       be used for backward compatibility. You never needed a pass
       phrase to load a certificate but you need one to load your pri-
       vate key.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
------------------------------
Message: 3
Date: Fri, 28 Oct 2005 12:25:43 +0300
From: LOL TOM <loltom_at_gmail.com>
Subject: cURL and Foxserv
To: curl-and-php_at_cool.haxx.se
Message-ID:
	<f13a2c1a0510280225k37803bb2vf81c21a77f7ee0a8_at_mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Hi all!
I have Foxserv 3 (PHP version 4.2.2) running on Win XP and I need to install
the cURL package so that I can use its functions!! My question is how can I
do install cURL? and which package I need to install??
PLEASE HELP!
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://cool.haxx.se/pipermail/curl-and-php/attachments/20051028/86d83672/att
achment.html
------------------------------
_______________________________________________
curl-and-php mailing list
curl-and-php_at_cool.haxx.se
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
End of curl-and-php Digest, Vol 2, Issue 9
******************************************
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2005-10-28