I am trying to use libcurl.net in my project to do HTTP requests over SSL. (System.Net classes do not support server name extension, and I am using Windows XP)
The code in SSLContextFunction :
public CURLcode OnSSLContext(SSLContext ctx, Object extraData)
{
IntPtr ssl = SSL_new(ctx.Context);
SSL_set_tlsext_host_name(ssl, "hostname");
return CURLcode.CURLE_OK;
}
[DllImport("ssleay32.dll")]
internal static extern IntPtr SSL_new(IntPtr ctx);
[DllImport("ssleay32.dll")]
internal static extern void SSL_set_tlsext_host_name(IntPtr ssl, string message);
This throws an error on the call SSL_new saying : "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Also, tried calling OpenSSL's method SSL_library_init() , but no result.
Thanks