CURLOPT_SSLCERT.3 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at https://curl.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" * SPDX-License-Identifier: curl
  22. .\" *
  23. .\" **************************************************************************
  24. .\"
  25. .TH CURLOPT_SSLCERT 3 "17 Jun 2014" libcurl libcurl
  26. .SH NAME
  27. CURLOPT_SSLCERT \- SSL client certificate
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLCERT, char *cert);
  32. .fi
  33. .SH DESCRIPTION
  34. Pass a pointer to a null-terminated string as parameter. The string should be
  35. the file name of your client certificate. The default format is "P12" on
  36. Secure Transport and "PEM" on other engines, and can be changed with
  37. \fICURLOPT_SSLCERTTYPE(3)\fP.
  38. With NSS or Secure Transport, this can also be the nickname of the certificate
  39. you wish to authenticate with as it is named in the security database. If you
  40. want to use a file from the current directory, please precede it with "./"
  41. prefix, in order to avoid confusion with a nickname.
  42. (Schannel only) Client certificates can be specified by a path expression to a
  43. certificate store. (You can import \fIPFX\fP to a store first). You can use
  44. "<store location>\\<store name>\\<thumbprint>" to refer to a certificate in
  45. the system certificates store, for example,
  46. \fB"CurrentUser\\MY\\934a7ac6f8a5d579285a74fa"\fP. The thumbprint is usually a
  47. SHA-1 hex string which you can see in certificate details. Following store
  48. locations are supported: \fBCurrentUser\fP, \fBLocalMachine\fP,
  49. \fBCurrentService\fP, \fBServices\fP, \fBCurrentUserGroupPolicy\fP,
  50. \fBLocalMachineGroupPolicy\fP, \fBLocalMachineEnterprise\fP. Schannel also
  51. support P12 certificate file, with the string "P12" specified with
  52. \fICURLOPT_SSLCERTTYPE(3)\fP.
  53. When using a client certificate, you most likely also need to provide a
  54. private key with \fICURLOPT_SSLKEY(3)\fP.
  55. The application does not have to keep the string around after setting this
  56. option.
  57. .SH DEFAULT
  58. NULL
  59. .SH PROTOCOLS
  60. All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
  61. .SH EXAMPLE
  62. .nf
  63. CURL *curl = curl_easy_init();
  64. if(curl) {
  65. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
  66. curl_easy_setopt(curl, CURLOPT_SSLCERT, "client.pem");
  67. curl_easy_setopt(curl, CURLOPT_SSLKEY, "key.pem");
  68. curl_easy_setopt(curl, CURLOPT_KEYPASSWD, "s3cret");
  69. ret = curl_easy_perform(curl);
  70. curl_easy_cleanup(curl);
  71. }
  72. .fi
  73. .SH AVAILABILITY
  74. If built TLS enabled.
  75. .SH RETURN VALUE
  76. Returns CURLE_OK if TLS enabled, CURLE_UNKNOWN_OPTION if not, or
  77. CURLE_OUT_OF_MEMORY if there was insufficient heap space.
  78. .SH "SEE ALSO"
  79. .BR CURLOPT_SSLCERTTYPE "(3), " CURLOPT_SSLKEY "(3), "