2
0

CURLOPT_CERTINFO.3 2.8 KB

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