CURLOPT_CAPATH.3 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. .\" generated by cd2nroff 0.1 from CURLOPT_CAPATH.md
  2. .TH CURLOPT_CAPATH 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_CAPATH \- directory holding CA certificates
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CAPATH, char *capath);
  9. .fi
  10. .SH DESCRIPTION
  11. Pass a char pointer to a null\-terminated string naming a directory holding
  12. multiple CA certificates to verify the peer with. If libcurl is built against
  13. OpenSSL, the certificate directory must be prepared using the OpenSSL c_rehash
  14. utility. This makes sense only when used in combination with the
  15. \fICURLOPT_SSL_VERIFYPEER(3)\fP option.
  16. The \fICURLOPT_CAPATH(3)\fP function apparently does not work in Windows due
  17. to some limitation in OpenSSL.
  18. The application does not have to keep the string around after setting this
  19. option.
  20. The default value for this can be figured out with \fICURLINFO_CAPATH(3)\fP.
  21. .SH DEFAULT
  22. A path detected at build time.
  23. .SH PROTOCOLS
  24. This functionality affects all TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
  25. This option works only with the following TLS backends:
  26. GnuTLS, OpenSSL, mbedTLS and wolfSSL
  27. .SH EXAMPLE
  28. .nf
  29. int main(void)
  30. {
  31. CURL *curl = curl_easy_init();
  32. if(curl) {
  33. CURLcode res;
  34. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
  35. curl_easy_setopt(curl, CURLOPT_CAPATH, "/etc/cert-dir");
  36. res = curl_easy_perform(curl);
  37. curl_easy_cleanup(curl);
  38. }
  39. }
  40. .fi
  41. .SH AVAILABILITY
  42. Added in curl 7.9.8
  43. .SH RETURN VALUE
  44. CURLE_OK if supported; or an error such as:
  45. CURLE_NOT_BUILT_IN \- Not supported by the SSL backend
  46. CURLE_UNKNOWN_OPTION
  47. CURLE_OUT_OF_MEMORY
  48. .SH SEE ALSO
  49. .BR CURLINFO_CAPATH (3),
  50. .BR CURLOPT_CAINFO (3),
  51. .BR CURLOPT_DEBUGFUNCTION (3),
  52. .BR CURLOPT_STDERR (3)