1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_SSLKEYTYPE 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_PROXY_SSLKEYTYPE (3) 9 - CURLOPT_SSLCERT (3) 10 - CURLOPT_SSLKEY (3) 11Protocol: 12 - TLS 13TLS-backend: 14 - OpenSSL 15 - BearSSL 16 - wolfSSL 17Added-in: 7.9.3 18--- 19 20# NAME 21 22CURLOPT_SSLKEYTYPE - type of the private key file 23 24# SYNOPSIS 25 26~~~c 27#include <curl/curl.h> 28 29CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLKEYTYPE, char *type); 30~~~ 31 32# DESCRIPTION 33 34Pass a pointer to a null-terminated string as parameter. The string should be 35the format of your private key. Supported formats are "PEM", "DER" and "ENG". 36 37The format "ENG" enables you to load the private key from a crypto engine. In 38this case CURLOPT_SSLKEY(3) is used as an identifier passed to the engine. You 39have to set the crypto engine with CURLOPT_SSLENGINE(3). "DER" format key file 40currently does not work because of a bug in OpenSSL. 41 42The application does not have to keep the string around after setting this 43option. 44 45Using this option multiple times makes the last set string override the 46previous ones. Set it to NULL to restore to internal default. 47 48# DEFAULT 49 50"PEM" 51 52# %PROTOCOLS% 53 54# EXAMPLE 55 56~~~c 57int main(void) 58{ 59 CURL *curl = curl_easy_init(); 60 if(curl) { 61 CURLcode res; 62 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); 63 curl_easy_setopt(curl, CURLOPT_SSLCERT, "client.pem"); 64 curl_easy_setopt(curl, CURLOPT_SSLKEY, "key.pem"); 65 curl_easy_setopt(curl, CURLOPT_SSLKEYTYPE, "PEM"); 66 curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "s3cret"); 67 res = curl_easy_perform(curl); 68 curl_easy_cleanup(curl); 69 } 70} 71~~~ 72 73# %AVAILABILITY% 74 75# RETURN VALUE 76 77Returns CURLE_OK if TLS is supported, CURLE_UNKNOWN_OPTION if not, or 78CURLE_OUT_OF_MEMORY if there was insufficient heap space. 79