curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

how to pass .crt file as CURLOPT

From: Venkat Maddisetti via curl-library <curl-library_at_lists.haxx.se>
Date: Tue, 1 Mar 2022 03:05:03 +0000

Hi,
I am using libcurl to Interface a 3rd party application that uses standard protocol HTTPS version 2 with client and server x.509 certificates and TLS v1.3 for authentication and encryption, and was provided with ".crt" and ".key" files. I am setting option with CURLOPT_SSLCERT and CURLOPT_SSLKEY with those files but fails to establish connection.
I looked at the curl documentation and on SSLCERTTYPE page there is a mention of just using PEM/DER that makes me think I am lost and seek some help from curl community.
My Curl Version is libcurl/7.73.0 and OpenSSL/1.1.1

    curl_easy_setopt(curl, CURLOPT_PORT, 3001);
    curl_easy_setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
    curl_easy_setopt(curl, CURLOPT_USERAGENT, "Go-http-client/2.0");
    curl_easy_setopt(curl, CURLOPT_SSLCERT, "./abc_lh.crt");
    curl_easy_setopt(curl, CURLOPT_SSLKEY, "./abc_lh.key");



curl:9b65b480, curlhandle:9b65b480
* STATE: INIT => CONNECT handle 0x2289b65b480; line 1796 (connection #-5000)
* Added connection 0. The cache now contains 1 members
* family0 == v4, family1 == v6
* Trying 192.168.11.200:3001...
* STATE: CONNECT => WAITCONNECT handle 0x2289b65b480; line 1857 (connection #0)
* connect to 192.168.11.200 port 3001 failed: Connection refused
* Failed to connect to 192.168.11.200 port 3001: Connection refused
* multi_done
* The cache now contains 0 members
* Closing connection 0

Error: Couldn't connect to server
failed to create curl request




-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2022-03-01