Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CURLINFO_CERTINFO.3: better explain curl_certinfo struct #11666

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 22 additions & 10 deletions docs/libcurl/opts/CURLINFO_CERTINFO.3
Expand Up @@ -33,13 +33,23 @@ CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CERTINFO,
struct curl_certinfo **chainp);
.fi
.SH DESCRIPTION
Pass a pointer to a \fIstruct curl_certinfo *\fP and you will get it set to
point to a struct that holds a number of linked lists with info about the
certificate chain, assuming you had \fICURLOPT_CERTINFO(3)\fP enabled when the
request was made. The struct reports how many certs it found and then you can
extract info for each of those certs by following the linked lists. The info
chain is provided in a series of data in the format "name:content" where the
content is for the specific named data. See also the \fIcertinfo.c\fP example.
Pass a pointer to a \fIstruct curl_certinfo *\fP and it will be set to point to
a struct that holds info about the server's certificate chain, assuming you had
\fICURLOPT_CERTINFO(3)\fP enabled when the request was made.

.nf
struct curl_certinfo {
int num_of_certs;
struct curl_slist **certinfo;
};
.fi

The \fIcertinfo\fP struct member is an array of linked lists of certificate
information. The \fInum_of_certs\fP struct member is the number of certificates
which is the number of elements in the array. Each certificate's list has items
with textual information in the format "name:content" such as "Subject:Foo",
"Issuer:Bar", etc. The items in each list will vary depending on the SSL
backend and the certificate.
.SH PROTOCOLS
All TLS-based
.SH EXAMPLE
Expand Down Expand Up @@ -74,10 +84,12 @@ if(curl) {
curl_easy_cleanup(curl);
}
.fi

See also the \fIcertinfo.c\fP example.
.SH AVAILABILITY
This option is only working in libcurl built with OpenSSL, Schannel or
Secure Transport support. Schannel support added in 7.50.0. Secure Transport
support added in 7.79.0.
This option is only working in libcurl built with OpenSSL, GnuTLS, Schannel or
Secure Transport. GnuTLS support added in 7.42.0. Schannel support added in
7.50.0. Secure Transport support added in 7.79.0.

Added in 7.19.1
.SH RETURN VALUE
Expand Down
9 changes: 5 additions & 4 deletions include/curl/curl.h
Expand Up @@ -2824,13 +2824,14 @@ CURL_EXTERN void curl_slist_free_all(struct curl_slist *list);
*/
CURL_EXTERN time_t curl_getdate(const char *p, const time_t *unused);

/* info about the certificate chain, only for OpenSSL, GnuTLS, Schannel and
NSS builds. Asked for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */
/* info about the certificate chain, for SSL backends that support it. Asked
for with CURLOPT_CERTINFO / CURLINFO_CERTINFO */
struct curl_certinfo {
int num_of_certs; /* number of certificates with information */
struct curl_slist **certinfo; /* for each index in this array, there's a
linked list with textual information in the
format "name: value" */
linked list with textual information for a
certificate in the format "name:content".
eg "Subject:foo", "Issuer:bar", etc. */
};

/* Information about the SSL library used and the respective internal SSL
Expand Down