CURLOPT_CERTINFO.3 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 1998 - 2021, 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. .\" **************************************************************************
  22. .\"
  23. .TH CURLOPT_CERTINFO 3 "19 Jun 2014" "libcurl 7.37.0" "curl_easy_setopt options"
  24. .SH NAME
  25. CURLOPT_CERTINFO \- request SSL certificate information
  26. .SH SYNOPSIS
  27. .nf
  28. #include <curl/curl.h>
  29. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CERTINFO, long certinfo);
  30. .fi
  31. .SH DESCRIPTION
  32. Pass a long set to 1 to enable libcurl's certificate chain info gatherer. With
  33. this enabled, libcurl will extract lots of information and data about the
  34. certificates in the certificate chain used in the SSL connection. This data
  35. may then be retrieved after a transfer using \fIcurl_easy_getinfo(3)\fP and
  36. its option \fICURLINFO_CERTINFO(3)\fP.
  37. .SH DEFAULT
  38. 0
  39. .SH PROTOCOLS
  40. All TLS-based
  41. .SH EXAMPLE
  42. .nf
  43. curl = curl_easy_init();
  44. if(curl) {
  45. curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/");
  46. /* connect to any HTTPS site, trusted or not */
  47. curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
  48. curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
  49. curl_easy_setopt(curl, CURLOPT_CERTINFO, 1L);
  50. res = curl_easy_perform(curl);
  51. if (!res) {
  52. struct curl_certinfo *ci;
  53. res = curl_easy_getinfo(curl, CURLINFO_CERTINFO, &ci);
  54. if (!res) {
  55. printf("%d certs!\\n", ci->num_of_certs);
  56. for(i = 0; i < ci->num_of_certs; i++) {
  57. struct curl_slist *slist;
  58. for(slist = ci->certinfo[i]; slist; slist = slist->next)
  59. printf("%s\\n", slist->data);
  60. }
  61. }
  62. }
  63. curl_easy_cleanup(curl);
  64. }
  65. .fi
  66. .SH AVAILABILITY
  67. This option is supported by the OpenSSL, GnuTLS, Schannel, NSS, GSKit and
  68. Secure Transport backends. Schannel support added in 7.50.0. Secure Transport
  69. support added in 7.79.0.
  70. .SH RETURN VALUE
  71. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  72. .SH "SEE ALSO"
  73. .BR CURLOPT_CAINFO "(3), " CURLOPT_SSL_VERIFYPEER "(3), "