xref: /curl/docs/libcurl/opts/CURLINFO_CAINFO.md (revision e3fe0200)
1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLINFO_CAINFO
5Section: 3
6Source: libcurl
7See-also:
8  - CURLINFO_CAPATH (3)
9  - curl_easy_getinfo (3)
10  - curl_easy_setopt (3)
11Protocol:
12  - TLS
13TLS-backend:
14  - All
15---
16
17# NAME
18
19CURLINFO_CAINFO - get the default built-in CA certificate path
20
21# SYNOPSIS
22
23~~~c
24#include <curl/curl.h>
25
26CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CAINFO, char **path);
27~~~
28
29# DESCRIPTION
30
31Pass a pointer to a char pointer to receive the pointer to a null-terminated
32string holding the default built-in path used for the CURLOPT_CAINFO(3)
33option unless set by the user.
34
35Note that in a situation where libcurl has been built to support multiple TLS
36libraries, this option might return a string even if the specific TLS library
37currently set to be used does not support CURLOPT_CAINFO(3).
38
39This is a path identifying a single file containing CA certificates.
40
41The **path** pointer is set to NULL if there is no default path.
42
43# EXAMPLE
44
45~~~c
46int main(void)
47{
48  CURL *curl = curl_easy_init();
49  if(curl) {
50    char *cainfo = NULL;
51    curl_easy_getinfo(curl, CURLINFO_CAINFO, &cainfo);
52    if(cainfo) {
53      printf("default ca info path: %s\n", cainfo);
54    }
55    curl_easy_cleanup(curl);
56  }
57}
58~~~
59
60# AVAILABILITY
61
62Added in 7.84.0
63
64# RETURN VALUE
65
66Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
67