CURLOPT_ISSUERCERT_BLOB.3 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. .\" generated by cd2nroff 0.1 from CURLOPT_ISSUERCERT_BLOB.md
  2. .TH CURLOPT_ISSUERCERT_BLOB 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_ISSUERCERT_BLOB \- issuer SSL certificate from memory blob
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_ISSUERCERT_BLOB,
  9. struct curl_blob *stblob);
  10. .fi
  11. .SH DESCRIPTION
  12. Pass a pointer to a curl_blob structure, which contains information (pointer
  13. and size) about a memory block with binary data of a CA certificate in PEM
  14. format. If the option is set, an additional check against the peer certificate
  15. is performed to verify the issuer is indeed the one associated with the
  16. certificate provided by the option. This additional check is useful in
  17. multi\-level PKI where one needs to enforce that the peer certificate is from a
  18. specific branch of the tree.
  19. This option should be used in combination with the
  20. \fICURLOPT_SSL_VERIFYPEER(3)\fP option. Otherwise, the result of the check is
  21. not considered as failure.
  22. A specific error code (CURLE_SSL_ISSUER_ERROR) is defined with the option,
  23. which is returned if the setup of the SSL/TLS session has failed due to a
  24. mismatch with the issuer of peer certificate (\fICURLOPT_SSL_VERIFYPEER(3)\fP
  25. has to be set too for the check to fail).
  26. If the blob is initialized with the flags member of struct curl_blob set to
  27. CURL_BLOB_COPY, the application does not have to keep the buffer around after
  28. setting this.
  29. This option is an alternative to \fICURLOPT_ISSUERCERT(3)\fP which instead
  30. expects a filename as input.
  31. .SH DEFAULT
  32. NULL
  33. .SH PROTOCOLS
  34. This functionality affects all TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
  35. This option works only with the following TLS backends:
  36. OpenSSL
  37. .SH EXAMPLE
  38. .nf
  39. extern char *certificateData;
  40. extern size_t filesize;
  41. int main(void)
  42. {
  43. CURL *curl = curl_easy_init();
  44. if(curl) {
  45. CURLcode res;
  46. struct curl_blob blob;
  47. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
  48. blob.data = certificateData;
  49. blob.len = filesize;
  50. blob.flags = CURL_BLOB_COPY;
  51. curl_easy_setopt(curl, CURLOPT_ISSUERCERT_BLOB, &blob);
  52. res = curl_easy_perform(curl);
  53. curl_easy_cleanup(curl);
  54. }
  55. }
  56. .fi
  57. .SH AVAILABILITY
  58. Added in curl 7.71.0
  59. .SH RETURN VALUE
  60. Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or
  61. CURLE_OUT_OF_MEMORY if there was insufficient heap space.
  62. .SH SEE ALSO
  63. .BR CURLOPT_CRLFILE (3),
  64. .BR CURLOPT_ISSUERCERT (3),
  65. .BR CURLOPT_SSL_VERIFYHOST (3),
  66. .BR CURLOPT_SSL_VERIFYPEER (3)