1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_KEYPASSWD 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_SSH_PRIVATE_KEYFILE (3) 9 - CURLOPT_SSLKEY (3) 10Protocol: 11 - TLS 12TLS-backend: 13 - OpenSSL 14 - mbedTLS 15 - Schannel 16 - wolfSSL 17Added-in: 7.17.0 18--- 19 20# NAME 21 22CURLOPT_KEYPASSWD - passphrase to private key 23 24# SYNOPSIS 25 26~~~c 27#include <curl/curl.h> 28 29CURLcode curl_easy_setopt(CURL *handle, CURLOPT_KEYPASSWD, char *pwd); 30~~~ 31 32# DESCRIPTION 33 34Pass a pointer to a null-terminated string as parameter. It is used as the 35password required to use the CURLOPT_SSLKEY(3) or 36CURLOPT_SSH_PRIVATE_KEYFILE(3) private key. You never need a passphrase to 37load a certificate but you need one to load your private key. 38 39The application does not have to keep the string around after setting this 40option. 41 42Using this option multiple times makes the last set string override the 43previous ones. Set it to NULL to disable its use again. 44 45# DEFAULT 46 47NULL 48 49# %PROTOCOLS% 50 51# EXAMPLE 52 53~~~c 54int main(void) 55{ 56 CURL *curl = curl_easy_init(); 57 if(curl) { 58 CURLcode res; 59 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin"); 60 curl_easy_setopt(curl, CURLOPT_SSLCERT, "client.pem"); 61 curl_easy_setopt(curl, CURLOPT_SSLKEY, "key.pem"); 62 curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "superman"); 63 res = curl_easy_perform(curl); 64 curl_easy_cleanup(curl); 65 } 66} 67~~~ 68 69# HISTORY 70 71This option was known as CURLOPT_SSLKEYPASSWD up to 7.16.4 and 72CURLOPT_SSLCERTPASSWD up to 7.9.2. 73 74# %AVAILABILITY% 75 76# RETURN VALUE 77 78Returns CURLE_OK if TLS enabled, CURLE_UNKNOWN_OPTION if not, or 79CURLE_OUT_OF_MEMORY if there was insufficient heap space. 80