CURLOPT_KEYPASSWD.3 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. .\" generated by cd2nroff 0.1 from CURLOPT_KEYPASSWD.md
  2. .TH CURLOPT_KEYPASSWD 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_KEYPASSWD \- passphrase to private key
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_KEYPASSWD, char *pwd);
  9. .fi
  10. .SH DESCRIPTION
  11. Pass a pointer to a null\-terminated string as parameter. It is used as the
  12. password required to use the \fICURLOPT_SSLKEY(3)\fP or
  13. \fICURLOPT_SSH_PRIVATE_KEYFILE(3)\fP private key. You never need a passphrase to
  14. load a certificate but you need one to load your private key.
  15. The application does not have to keep the string around after setting this
  16. option.
  17. .SH DEFAULT
  18. NULL
  19. .SH PROTOCOLS
  20. This functionality affects all TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
  21. This option works only with the following TLS backends:
  22. OpenSSL, Schannel, mbedTLS and wolfSSL
  23. .SH EXAMPLE
  24. .nf
  25. int main(void)
  26. {
  27. CURL *curl = curl_easy_init();
  28. if(curl) {
  29. CURLcode res;
  30. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
  31. curl_easy_setopt(curl, CURLOPT_SSLCERT, "client.pem");
  32. curl_easy_setopt(curl, CURLOPT_SSLKEY, "key.pem");
  33. curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "superman");
  34. res = curl_easy_perform(curl);
  35. curl_easy_cleanup(curl);
  36. }
  37. }
  38. .fi
  39. .SH HISTORY
  40. This option was known as CURLOPT_SSLKEYPASSWD up to 7.16.4 and
  41. CURLOPT_SSLCERTPASSWD up to 7.9.2.
  42. .SH AVAILABILITY
  43. Added in curl 7.17.0
  44. .SH RETURN VALUE
  45. Returns CURLE_OK if TLS enabled, CURLE_UNKNOWN_OPTION if not, or
  46. CURLE_OUT_OF_MEMORY if there was insufficient heap space.
  47. .SH SEE ALSO
  48. .BR CURLOPT_SSH_PRIVATE_KEYFILE (3),
  49. .BR CURLOPT_SSLKEY (3)