Thanks Oscar. In my scenario, I am reading from the socket handle 
extracted(using CURLINFO_LASTSOCKET)  from curl using socket recv call. Is 
there a way to get the ssl handle as well and then decrypt the data from the 
socket using ssl_read.

In my scenario, we are using the curl library to initiate a  connection to a 
custom server(not a webserver) and then the server grabs the socket on which 
the connection was received and starts writing data using ssl_write. It's a 
kind of long polling socket implementation.



-----Original Message-----
From: curl-library [mailto:[email protected]] On Behalf Of 
Oscar Koeroo
Sent: Friday, October 19, 2012 9:38 AM
To: [email protected]
Subject: Re: How can i get the SSL context from a curl handle

On 18-10-12 19:43, Mayank Kumar (mayankum) wrote:
> Resending since I didn't get any response. Is there a way to extract 
> the ssl context  for the https connection initiated so that we could 
> use SSL_read on the socket handle extracted from the curl handle.
> 
> From: Mayank Kumar (mayankum) Sent: Tuesday, October 02, 2012 4:08 PM To:
> [email protected] Subject: How can i get the SSL context from 
> a curl handle
> 
> Here is what I am trying to do :-
> 
> 
> 1.      Initiate a https connection using curl_easy_perform
> 
> 2.      Extract the socket  from curl handle
> 
> 3.      Extract the ssl context from the curl handle and then use
> SSL_read to read the data from the socket since the other side will 
> send encrypted data written using SSL_write.
> 
> 
> Not sure how to get 3 working.
> 
> Thanks Mayank


I'm inclined to simply answer: This is already taken care of by libcurl.

A libcurl build against OpenSSL would even use SSL_read() to get a hold of the 
data. Perhaps this libcurl example might be helpful:
http://curl.haxx.se/libcurl/c/getinmemory.html

The magic is that libcurl will provide you the decrypted data through the 
CURLOPT_WRITEFUNCTION callback, for example. No need to bother with
SSL_read() on the libcurl end.


does this help?

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to