cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Re: Problem with certificate private key

From: Dmitry <dimarikson2_at_yandex.ru>
Date: Thu, 31 Dec 2009 16:40:36 +0300

28.12.09, 20:25, "Kamil Dudka" <kdudka_at_redhat.com>:

> On Monday 28 of December 2009 18:50:22 . Дмитрий wrote:
> > I have faced with a problem: when I try to send request, curl generates
> > error: "unable to set private key file". But I have a certificate with only
> > a public key. Private key is not provided by the site (so only output
> > messages being encrypted). Without certificate post request being refused.
> >
> > If a browser is able to communicate with a site, then curl also must be
> > able to do the same. How to disable checking of a private key?
>
> AFAIK you always need a private key while using a client certificate, though
> the key can be embeded in the cert file. If you don't have a separate file
> with a key, simply do not use the option for key and it should work fine.
>
> Kamil
>
>

Well, I have found a solution how to avoid this misfunction. Here I have used "fsockopen" php function.
First, I use "OpenSSL" to export public key from the certificate. Then encrypted variables string data (i.e. name=myname&country=mycountry) that should be send with openssl, using this key.
Next, I have created string for "fsockopen" function, including post-method, headers string and encrypted variables string (some sample: http://www.php.net/manual/en/function.fsockopen.php#91554).
Generally that's all! The response was as I expect!

The new year is coming.. I went away to drink and have fun.. :)
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-12-31