curl-library
How to set the default crypto engine to openssl in Curl
Date: Tue, 24 Jul 2007 21:20:08 +0530
Hi,
I am a novice libcurl user. I have written a simple c program using libcurl
to access an https URL.
What are the ssl crypto engines supported by CURL ?
I have generated ca,server and client certificates using openssl. Does it
mean i should use openssl crypto engine. ?
I want to use openssl crypto engine. What string value I should use for the
option CURLOPT_SSLENGINE to use openssl as ssl engine ?
My Program is as below
int main(int argc, char **argv)
{
CURL *curl;
CURLcode res;
FILE *headerfile;
const char *pPassphrase = NULL;
struct curl_slist *list;
static const char *pCertFile = "testcert.pem";
static const char *pCACertFile="ca.pem";
const char *pKeyName;
const char *pKeyType;
char name[60];
const char *pEngine;
pKeyName = "testkey.pem";
pKeyType = "PEM";
pEngine = "openssl"; /* What should I set here. If
set to openssl it says can't set crypto engine. */
headerfile = fopen("dumpit", "w");
curl_global_init(CURL_GLOBAL_DEFAULT);
curl = curl_easy_init();
if(curl) {
/* what call to write: */
curl_easy_setopt(curl, CURLOPT_URL, "https://www.myserver.com");
curl_easy_setopt(curl, CURLOPT_WRITEHEADER, headerfile);
while(1) /* do some ugly short cut... */
{
if (pEngine) /* use crypto engine */
{
//what is sslengine which engines can we use
if (curl_easy_setopt(curl, CURLOPT_SSLENGINE,pEngine) != CURLE_OK)
{ /* load the crypto engine */
fprintf(stderr,"can't set crypto engine\n");
break;
}
// what is default ssl engine ?
if (curl_easy_setopt(curl, CURLOPT_SSLENGINE_DEFAULT,1) !=
CURLE_OK)
{ /* set the crypto engine as default */
/* only needed for the first time you load
a engine in a curl object... */
fprintf(stderr,"can't set crypto engine as default\n");
break;
}
}
}
If i do use command curl --engine list , it shows "dynamic" in result. Even
If I set pEngine to "dynamic", it says cant load crypto engine
Please help.
Thanks,
Parag
Received on 2007-07-24