cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Using custom ssl certificate from memory

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 5 Mar 2014 17:14:34 +0100 (CET)

On Tue, 4 Mar 2014, Ruslan Gaifulin wrote:

> I created a bundle with mk-ca-bundle named C:\mybundle.cer
> I check it like
> curl_easy_setopt(curl, CURLOPT_CAINFO, "C:\\mybundle.cer");
> curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, true);

I advice you to instead pass a 1L as argument. "true" is not necessarily a
long set to 1.

> And was able to login to the server. Now I need to use certificate info from
> memory i.e. with

You thus want the CA cert from memory (just saying "ssl certificate" is a bit
vague and ambigious). Did you try the example showing this?

   http://curl.haxx.se/libcurl/c/cacertinmem.html

> *static CURLcode sslctx_function(CURL * curl, void * sslctx, void *
> parm){ X509_STORE * store; X509 * cert=NULL; BIO * bio;
> std::fstream myfile; myfile.open("C:\\certdata"); std::string
> certText; std::string line; while(std::getline(myfile, line))

... your source code formatting in a text-only mail client is a bit hard to
parse...

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2014-03-05