CURLOPT_CAINFO.3 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. .\" generated by cd2nroff 0.1 from CURLOPT_CAINFO.md
  2. .TH CURLOPT_CAINFO 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_CAINFO \- path to Certificate Authority (CA) bundle
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CAINFO, char *path);
  9. .fi
  10. .SH DESCRIPTION
  11. Pass a char pointer to a null\-terminated string naming a file holding one or
  12. more certificates to verify the peer with.
  13. If \fICURLOPT_SSL_VERIFYPEER(3)\fP is zero and you avoid verifying the
  14. server\(aqs certificate, \fICURLOPT_CAINFO(3)\fP need not even indicate an
  15. accessible file.
  16. This option is by default set to the system path where libcurl\(aqs CA
  17. certificate bundle is assumed to be stored, as established at build time.
  18. (iOS and macOS) When curl uses Secure Transport this option is supported. If
  19. the option is not set, then curl uses the certificates in the system and user
  20. Keychain to verify the peer.
  21. (Schannel) This option is supported for Schannel in Windows 7 or later but we
  22. recommend not using it until Windows 8 since it works better starting then.
  23. If the option is not set, then curl uses the certificates in the Windows\(aq
  24. store of root certificates (the default for Schannel).
  25. The application does not have to keep the string around after setting this
  26. option.
  27. The default value for this can be figured out with \fICURLINFO_CAINFO(3)\fP.
  28. .SH DEFAULT
  29. Built\-in system specific. When curl is built with Secure Transport or
  30. Schannel, this option is not set by default.
  31. .SH PROTOCOLS
  32. This functionality affects all TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
  33. All TLS backends support this option.
  34. .SH EXAMPLE
  35. .nf
  36. int main(void)
  37. {
  38. CURL *curl = curl_easy_init();
  39. if(curl) {
  40. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
  41. curl_easy_setopt(curl, CURLOPT_CAINFO, "/etc/certs/cabundle.pem");
  42. curl_easy_perform(curl);
  43. curl_easy_cleanup(curl);
  44. }
  45. }
  46. .fi
  47. .SH HISTORY
  48. Schannel support added in libcurl 7.60.
  49. .SH AVAILABILITY
  50. Added in curl 7.4.2
  51. .SH RETURN VALUE
  52. Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or
  53. CURLE_OUT_OF_MEMORY if there was insufficient heap space.
  54. .SH SEE ALSO
  55. .BR CURLINFO_CAINFO (3),
  56. .BR CURLOPT_CAINFO_BLOB (3),
  57. .BR CURLOPT_CAPATH (3),
  58. .BR CURLOPT_CA_CACHE_TIMEOUT (3),
  59. .BR CURLOPT_SSL_VERIFYHOST (3),
  60. .BR CURLOPT_SSL_VERIFYPEER (3)