CURLOPT_CERTINFO.3 2.7 KB

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