CURLOPT_ISSUERCERT.3 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. .\" generated by cd2nroff 0.1 from CURLOPT_ISSUERCERT.md
  2. .TH CURLOPT_ISSUERCERT 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_ISSUERCERT \- issuer SSL certificate filename
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ISSUERCERT, char *file);
  9. .fi
  10. .SH DESCRIPTION
  11. Pass a char pointer to a null\-terminated string naming a \fIfile\fP holding a CA
  12. certificate in PEM format. If the option is set, an additional check against
  13. the peer certificate is performed to verify the issuer is indeed the one
  14. associated with the certificate provided by the option. This additional check
  15. is useful in multi\-level PKI where one needs to enforce that the peer
  16. certificate is from a specific branch of the tree.
  17. This option makes sense only when used in combination with the
  18. \fICURLOPT_SSL_VERIFYPEER(3)\fP option. Otherwise, the result of the check is
  19. not considered as failure.
  20. A specific error code (CURLE_SSL_ISSUER_ERROR) is defined with the option,
  21. which is returned if the setup of the SSL/TLS session has failed due to a
  22. mismatch with the issuer of peer certificate (\fICURLOPT_SSL_VERIFYPEER(3)\fP
  23. has to be set too for the check to fail). (Added in 7.19.0)
  24. The application does not have to keep the string around after setting this
  25. option.
  26. .SH DEFAULT
  27. NULL
  28. .SH PROTOCOLS
  29. This functionality affects all TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
  30. This option works only with the following TLS backends:
  31. GnuTLS and OpenSSL
  32. .SH EXAMPLE
  33. .nf
  34. int main(void)
  35. {
  36. CURL *curl = curl_easy_init();
  37. if(curl) {
  38. CURLcode res;
  39. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
  40. curl_easy_setopt(curl, CURLOPT_ISSUERCERT, "/etc/certs/cacert.pem");
  41. res = curl_easy_perform(curl);
  42. curl_easy_cleanup(curl);
  43. }
  44. }
  45. .fi
  46. .SH AVAILABILITY
  47. Added in curl 7.19.0
  48. .SH RETURN VALUE
  49. Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or
  50. CURLE_OUT_OF_MEMORY if there was insufficient heap space.
  51. .SH SEE ALSO
  52. .BR CURLOPT_CRLFILE (3),
  53. .BR CURLOPT_SSL_VERIFYHOST (3),
  54. .BR CURLOPT_SSL_VERIFYPEER (3)