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 17--- 18 19# NAME 20 21CURLOPT_SSLKEYTYPE - type of the private key file 22 23# SYNOPSIS 24 25~~~c 26#include <curl/curl.h> 27 28CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLKEYTYPE, char *type); 29~~~ 30 31# DESCRIPTION 32 33Pass a pointer to a null-terminated string as parameter. The string should be 34the format of your private key. Supported formats are "PEM", "DER" and "ENG". 35 36The format "ENG" enables you to load the private key from a crypto engine. In 37this case CURLOPT_SSLKEY(3) is used as an identifier passed to the engine. You 38have to set the crypto engine with CURLOPT_SSLENGINE(3). "DER" format key file 39currently does not work because of a bug in OpenSSL. 40 41The application does not have to keep the string around after setting this 42option. 43 44# DEFAULT 45 46"PEM" 47 48# EXAMPLE 49 50~~~c 51int main(void) 52{ 53 CURL *curl = curl_easy_init(); 54 if(curl) { 55 CURLcode res; 56 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); 57 curl_easy_setopt(curl, CURLOPT_SSLCERT, "client.pem"); 58 curl_easy_setopt(curl, CURLOPT_SSLKEY, "key.pem"); 59 curl_easy_setopt(curl, CURLOPT_SSLKEYTYPE, "PEM"); 60 curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "s3cret"); 61 res = curl_easy_perform(curl); 62 curl_easy_cleanup(curl); 63 } 64} 65~~~ 66 67# AVAILABILITY 68 69If built TLS enabled. 70 71# RETURN VALUE 72 73Returns CURLE_OK if TLS is supported, CURLE_UNKNOWN_OPTION if not, or 74CURLE_OUT_OF_MEMORY if there was insufficient heap space. 75