Revert "Imported Upstream version 7.53.1"
[platform/upstream/curl.git] / docs / libcurl / opts / CURLINFO_TLS_SSL_PTR.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2  "http://www.w3.org/TR/html4/loose.dtd">
3 <html><head>
4 <title>CURLINFO_TLS_SSL_PTR man page</title>
5 <meta name="generator" content="roffit">
6 <STYLE type="text/css">
7 pre {
8   overflow: auto;
9   margin: 0;
10 }
11
12 P.level0, pre.level0 {
13  padding-left: 2em;
14 }
15
16 P.level1, pre.level1 {
17  padding-left: 4em;
18 }
19
20 P.level2, pre.level2 {
21  padding-left: 6em;
22 }
23
24 span.emphasis {
25  font-style: italic;
26 }
27
28 span.bold {
29  font-weight: bold;
30 }
31
32 span.manpage {
33  font-weight: bold;
34 }
35
36 h2.nroffsh {
37  background-color: #e0e0e0;
38 }
39
40 span.nroffip {
41  font-weight: bold;
42  font-size: 120%;
43  font-family: monospace;
44 }
45
46 p.roffit {
47  text-align: center;
48  font-size: 80%;
49 }
50 </STYLE>
51 </head><body>
52
53 <p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2>
54 <p class="level0">CURLINFO_TLS_SESSION, CURLINFO_TLS_SSL_PTR - get TLS session info <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2>
55 <p class="level0"><pre class="level0">
56 &#35;include &lt;curl/curl.h&gt;
57 &nbsp;
58 CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_TLS_SSL_PTR,
59 &nbsp;                          struct curl_tlssessioninfo **session);
60 &nbsp;
61 /* if you need compatibility with libcurl &lt; 7.48.0 use
62 &nbsp;  CURLINFO_TLS_SESSION instead: */
63 &nbsp;
64 CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_TLS_SESSION,
65 &nbsp;                          struct curl_tlssessioninfo **session);
66 </pre>
67 <a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2>
68 <p class="level0">Pass a pointer to a 'struct curl_tlssessioninfo *'.  The pointer will be initialized to refer to a 'struct curl_tlssessioninfo *' that will contain an enum indicating the SSL library used for the handshake and a pointer to the respective internal TLS session structure of this underlying SSL library. 
69 <p class="level0">This option may be useful for example to extract certificate information in a format convenient for further processing, such as manual validation. Refer to the <a class="bold" href="#LIMITATIONS">LIMITATIONS</a> section. 
70 <p class="level0"><pre class="level0">
71 struct curl_tlssessioninfo {
72 &nbsp; curl_sslbackend backend;
73 &nbsp; void *internals;
74 };
75 </pre>
76
77 <p class="level0">
78 <p class="level0">The <span Class="emphasis">backend</span> struct member is one of the defines in the CURLSSLBACKEND_* series: CURLSSLBACKEND_NONE (when built without TLS support), CURLSSLBACKEND_AXTLS, CURLSSLBACKEND_CYASSL, CURLSSLBACKEND_DARWINSSL, CURLSSLBACKEND_GNUTLS, CURLSSLBACKEND_GSKIT, CURLSSLBACKEND_MBEDTLS, CURLSSLBACKEND_NSS, CURLSSLBACKEND_OPENSSL, CURLSSLBACKEND_POLARSSL or CURLSSLBACKEND_SCHANNEL. (Note that the OpenSSL forks are all reported as just OpenSSL here.) 
79 <p class="level0">The <span Class="emphasis">internals</span> struct member will point to a TLS library specific pointer for the active ("in use") SSL connection, with the following underlying types: 
80 <p class="level1">
81 <p class="level0"><a name="GnuTLS"></a><span class="nroffip">GnuTLS</span> 
82 <p class="level1">gnutls_session_t 
83 <p class="level0"><a name="gskit"></a><span class="nroffip">gskit</span> 
84 <p class="level1">gsk_handle 
85 <p class="level0"><a name="NSS"></a><span class="nroffip">NSS</span> 
86 <p class="level1">PRFileDesc * 
87 <p class="level0"><a name="OpenSSL"></a><span class="nroffip">OpenSSL</span> 
88 <p class="level1">CURLINFO_TLS_SESSION: SSL_CTX * 
89 <p class="level1">CURLINFO_TLS_SSL_PTR: SSL * 
90 <p class="level0">Since 7.48.0 the <span Class="emphasis">internals</span> member can point to these other SSL backends as well: 
91 <p class="level1">
92 <p class="level0"><a name="axTLS"></a><span class="nroffip">axTLS</span> 
93 <p class="level1">SSL * 
94 <p class="level0"><a name="mbedTLS"></a><span class="nroffip">mbedTLS</span> 
95 <p class="level1">mbedtls_ssl_context * 
96 <p class="level0"><a name="PolarSSL"></a><span class="nroffip">PolarSSL</span> 
97 <p class="level1">ssl_context * 
98 <p class="level0"><a name="Secure"></a><span class="nroffip">Secure Channel (WinSSL)</span> 
99 <p class="level1">CtxtHandle * 
100 <p class="level0"><a name="Secure"></a><span class="nroffip">Secure Transport (DarwinSSL)</span> 
101 <p class="level1">SSLContext * 
102 <p class="level0"><a name="WolfSSL"></a><span class="nroffip">WolfSSL (formerly CyaSSL)</span> 
103 <p class="level1">SSL * 
104 <p class="level0">
105 <p class="level0">If the <span Class="emphasis">internals</span> pointer is NULL then either the SSL backend is not supported, an SSL session has not yet been established or the connection is no longer associated with the easy handle (eg curl_easy_perform has returned). <a name="LIMITATIONS"></a><h2 class="nroffsh">LIMITATIONS</h2>
106 <p class="level0"><span class="bold">This option has some limitations that could make it unsafe when it comes to the manual verification of certificates.</span> 
107 <p class="level0">This option only retrieves the first in-use SSL session pointer for your easy handle, however your easy handle may have more than one in-use SSL session if using FTP over SSL. That is because the FTP protocol has a control channel and a data channel and one or both may be over SSL. <span class="bold">Currently there is no way to retrieve a second in-use SSL session associated with an easy handle.</span> 
108 <p class="level0">This option has not been thoroughly tested with plaintext protocols that can be upgraded/downgraded to/from SSL: FTP, SMTP, POP3, IMAP when used with <a Class="emphasis" href="./CURLOPT_USE_SSL.html">CURLOPT_USE_SSL</a>. Though you will be able to retrieve the SSL pointer, it's possible that before you can do that <span class="bold">data (including auth) may have already been sent over a connection after it was upgraded.</span> 
109 <p class="level0">Renegotiation. If unsafe renegotiation or renegotiation in a way that the certificate is allowed to change is allowed by your SSL library this may occur and the certificate may change, and <span class="bold">data may continue to be sent or received after renegotiation but before you are able to get the (possibly) changed SSL pointer,</span> with the (possibly) changed certificate information. 
110 <p class="level0">If you are using OpenSSL or wolfSSL then <a Class="emphasis" href="./CURLOPT_SSL_CTX_FUNCTION.html">CURLOPT_SSL_CTX_FUNCTION</a> can be used to set a certificate verification callback in the CTX. That is safer than using this option to poll for certificate changes and doesn't suffer from any of the problems above. There is currently no way in libcurl to set a verification callback for the other SSL backends. 
111 <p class="level0">How are you using this option? Are you affected by any of these limitations? Please let us know by making a comment at <a href="https://github.com/curl/curl/issues/685">https://github.com/curl/curl/issues/685</a> <a name="PROTOCOLS"></a><h2 class="nroffsh">PROTOCOLS</h2>
112 <p class="level0">All TLS-based <a name="EXAMPLE"></a><h2 class="nroffsh">EXAMPLE</h2>
113 <p class="level0">TODO <a name="AVAILABILITY"></a><h2 class="nroffsh">AVAILABILITY</h2>
114 <p class="level0">Added in 7.48.0. 
115 <p class="level0">This option supersedes <a Class="emphasis" href="./CURLINFO_TLS_SESSION.html">CURLINFO_TLS_SESSION</a> which was added in 7.34.0. This option is exactly the same as that option except in the case of OpenSSL. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2>
116 <p class="level0">Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2>
117 <p class="level0"><span Class="manpage">curl_easy_getinfo (3)</span>, <span Class="manpage">curl_easy_setopt (3)</span>, <a Class="manpage" href="./CURLINFO_TLS_SESSION.html">CURLINFO_TLS_SESSION</a><p class="roffit">
118  This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>.
119 </body></html>