CURLOPT_SSLCERT_BLOB.3 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. .\" generated by cd2nroff 0.1 from CURLOPT_SSLCERT_BLOB.md
  2. .TH CURLOPT_SSLCERT_BLOB 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_SSLCERT_BLOB \- SSL client certificate from memory blob
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLCERT_BLOB,
  9. struct curl_blob *stblob);
  10. .fi
  11. .SH DESCRIPTION
  12. Pass a pointer to a curl_blob structure, which contains (pointer and size) a
  13. client certificate. The format must be "P12" on Secure Transport or
  14. Schannel. The format must be "P12" or "PEM" on OpenSSL. The format must be
  15. \&"DER" or "PEM" on mbedTLS. The format must be specified with
  16. \fICURLOPT_SSLCERTTYPE(3)\fP.
  17. If the blob is initialized with the flags member of struct curl_blob set to
  18. CURL_BLOB_COPY, the application does not have to keep the buffer around after
  19. setting this.
  20. This option is an alternative to \fICURLOPT_SSLCERT(3)\fP which instead
  21. expects a filename as input.
  22. .SH DEFAULT
  23. NULL
  24. .SH PROTOCOLS
  25. This functionality affects all TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
  26. This option works only with the following TLS backends:
  27. OpenSSL, Schannel, Secure Transport and mbedTLS
  28. .SH EXAMPLE
  29. .nf
  30. extern char *certificateData; /* point to data */
  31. extern size_t filesize; /* size of data */
  32. int main(void)
  33. {
  34. CURL *curl = curl_easy_init();
  35. if(curl) {
  36. CURLcode res;
  37. struct curl_blob stblob;
  38. stblob.data = certificateData;
  39. stblob.len = filesize;
  40. stblob.flags = CURL_BLOB_COPY;
  41. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
  42. curl_easy_setopt(curl, CURLOPT_SSLCERT_BLOB, &stblob);
  43. curl_easy_setopt(curl, CURLOPT_SSLCERTTYPE, "P12");
  44. curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "s3cret");
  45. res = curl_easy_perform(curl);
  46. curl_easy_cleanup(curl);
  47. }
  48. }
  49. .fi
  50. .SH AVAILABILITY
  51. Added in curl 7.71.0
  52. .SH RETURN VALUE
  53. Returns CURLE_OK if TLS enabled, CURLE_UNKNOWN_OPTION if not, or
  54. CURLE_OUT_OF_MEMORY if there was insufficient heap space.
  55. .SH SEE ALSO
  56. .BR CURLOPT_KEYPASSWD (3),
  57. .BR CURLOPT_SSLCERTTYPE (3),
  58. .BR CURLOPT_SSLKEY (3)