1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.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) 11Protocol: 12 - TLS 13TLS-backend: 14 - OpenSSL 15 - mbedTLS 16 - Schannel 17 - wolfSSL 18Added-in: 7.9.3 19--- 20 21# NAME 22 23CURLOPT_SSLKEY - private key file for TLS and SSL client cert 24 25# SYNOPSIS 26 27~~~c 28#include <curl/curl.h> 29 30CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLKEY, char *keyfile); 31~~~ 32 33# DESCRIPTION 34 35Pass a pointer to a null-terminated string as parameter. The string should be 36the filename of your private key. The default format is "PEM" and can be 37changed with CURLOPT_SSLKEYTYPE(3). 38 39(Windows, iOS and macOS) This option is ignored by Secure Transport and 40Schannel SSL backends because they expect the private key to be already present 41in the key-chain or PKCS#12 file containing the certificate. 42 43The application does not have to keep the string around after setting this 44option. 45 46Using this option multiple times makes the last set string override the 47previous ones. Set it to NULL to disable its use again. 48 49# DEFAULT 50 51NULL 52 53# %PROTOCOLS% 54 55# EXAMPLE 56 57~~~c 58int main(void) 59{ 60 CURL *curl = curl_easy_init(); 61 if(curl) { 62 CURLcode res; 63 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); 64 curl_easy_setopt(curl, CURLOPT_SSLCERT, "client.pem"); 65 curl_easy_setopt(curl, CURLOPT_SSLKEY, "key.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