1--- 2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_SSLKEY 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_SSLCERT (3) 9 - CURLOPT_SSLKEYTYPE (3) 10 - CURLOPT_SSLKEY_BLOB (3) 11--- 12 13# NAME 14 15CURLOPT_SSLKEY - private key file for TLS and SSL client cert 16 17# SYNOPSIS 18 19~~~c 20#include <curl/curl.h> 21 22CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLKEY, char *keyfile); 23~~~ 24 25# DESCRIPTION 26 27Pass a pointer to a null-terminated string as parameter. The string should be 28the filename of your private key. The default format is "PEM" and can be 29changed with CURLOPT_SSLKEYTYPE(3). 30 31(Windows, iOS and Mac OS X) This option is ignored by Secure Transport and 32Schannel SSL backends because they expect the private key to be already present 33in the key-chain or PKCS#12 file containing the certificate. 34 35The application does not have to keep the string around after setting this 36option. 37 38# DEFAULT 39 40NULL 41 42# PROTOCOLS 43 44All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. 45 46# EXAMPLE 47 48~~~c 49int main(void) 50{ 51 CURL *curl = curl_easy_init(); 52 if(curl) { 53 CURLcode res; 54 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); 55 curl_easy_setopt(curl, CURLOPT_SSLCERT, "client.pem"); 56 curl_easy_setopt(curl, CURLOPT_SSLKEY, "key.pem"); 57 curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "s3cret"); 58 res = curl_easy_perform(curl); 59 curl_easy_cleanup(curl); 60 } 61} 62~~~ 63 64# AVAILABILITY 65 66If built TLS enabled. 67 68# RETURN VALUE 69 70Returns CURLE_OK if TLS is supported, CURLE_UNKNOWN_OPTION if not, or 71CURLE_OUT_OF_MEMORY if there was insufficient heap space. 72