Hello,
I am trying to set secure connection using curl + ssl. Unfortunatell fo following code I get error "Problem with the local SSL certificate".
Can anyone help?
CURL *curl;
CURLcode res;
curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, "https://somesite.com:1443/blahblah");
const char *pCertFile = GetResourcePath(APP_DIR_RESOURCE, "cert.pem");
const char *pkFile = GetResourcePath(APP_DIR_RESOURCE, "pk.pem");
const char *caFile = "/opt/share/cert-svc/ca-certificate.crt";
curl_easy_setopt(curl, CURLOPT_SSLCERT, pCertFile);
curl_easy_setopt(curl, CURLOPT_SSLKEY, pkFile);
curl_easy_setopt(curl, CURLOPT_CAINFO, "/opt/share/cert-svc/ca-certificate.crt");
res = curl_easy_perform(curl);
if (res != CURLE_OK)
dlog_print(DLOG_ERROR, LOG_TAG, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
curl_easy_cleanup(curl);
curl_global_cleanup();
More details :
E/app ( 518): == Info: STATE: INIT => CONNECT handle 0xb77e8d88; line 1034 (connection #-5000)
E/app ( 518): == Info: Added connection 0. The cache now contains 1 members
E/app ( 518): == Info: Trying xxx.xxx.xxx.xxx...
E/app ( 518): == Info: STATE: CONNECT => WAITCONNECT handle 0xb77e8d88; line 1087 (connection #0)
E/app ( 518): == Info: Connected to somesite.com (xxx.xxx.xxx.xxx) port 1443 (#0)
E/app ( 518): == Info: Marked for [keep alive]: HTTP default
E/app ( 518): == Info: unable to use client certificate (no key found or wrong pass phrase?)
E/app ( 518): == Info: Marked for [closure]: Failed HTTPS connection
E/app ( 518): == Info: Closing connection 0
E/app ( 518): == Info: The cache now contains 0 members
E/app ( 518): == Info: Expire cleared