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