Update to version 2.33.1
[profile/ivi/glib2.git] / docs / reference / gio / html / GTlsConnection.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>GTlsConnection</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
7 <link rel="home" href="index.html" title="GIO Reference Manual">
8 <link rel="up" href="tls.html" title="TLS (SSL) support">
9 <link rel="prev" href="GTlsCertificate.html" title="GTlsCertificate">
10 <link rel="next" href="GTlsClientConnection.html" title="GTlsClientConnection">
11 <meta name="generator" content="GTK-Doc V1.18 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 </head>
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
16 <tr valign="middle">
17 <td><a accesskey="p" href="GTlsCertificate.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
18 <td><a accesskey="u" href="tls.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
19 <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
20 <th width="100%" align="center">GIO Reference Manual</th>
21 <td><a accesskey="n" href="GTlsClientConnection.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
22 </tr>
23 <tr><td colspan="5" class="shortcuts">
24 <a href="#GTlsConnection.synopsis" class="shortcut">Top</a>
25                    | 
26                   <a href="#GTlsConnection.description" class="shortcut">Description</a>
27                    | 
28                   <a href="#GTlsConnection.object-hierarchy" class="shortcut">Object Hierarchy</a>
29                    | 
30                   <a href="#GTlsConnection.derived-interfaces" class="shortcut">Known Derived Interfaces</a>
31                    | 
32                   <a href="#GTlsConnection.properties" class="shortcut">Properties</a>
33                    | 
34                   <a href="#GTlsConnection.signals" class="shortcut">Signals</a>
35 </td></tr>
36 </table>
37 <div class="refentry">
38 <a name="GTlsConnection"></a><div class="titlepage"></div>
39 <div class="refnamediv"><table width="100%"><tr>
40 <td valign="top">
41 <h2><span class="refentrytitle"><a name="GTlsConnection.top_of_page"></a>GTlsConnection</span></h2>
42 <p>GTlsConnection — TLS connection type</p>
43 </td>
44 <td valign="top" align="right"></td>
45 </tr></table></div>
46 <div class="refsynopsisdiv">
47 <a name="GTlsConnection.synopsis"></a><h2>Synopsis</h2>
48 <pre class="synopsis">
49 #include &lt;gio/gio.h&gt;
50
51                     <a class="link" href="GTlsConnection.html#GTlsConnection-struct" title="GTlsConnection">GTlsConnection</a>;
52 <span class="returnvalue">void</span>                <a class="link" href="GTlsConnection.html#g-tls-connection-set-certificate" title="g_tls_connection_set_certificate ()">g_tls_connection_set_certificate</a>    (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
53                                                          <em class="parameter"><code><a class="link" href="GTlsCertificate.html" title="GTlsCertificate"><span class="type">GTlsCertificate</span></a> *certificate</code></em>);
54 <a class="link" href="GTlsCertificate.html" title="GTlsCertificate"><span class="returnvalue">GTlsCertificate</span></a> *   <a class="link" href="GTlsConnection.html#g-tls-connection-get-certificate" title="g_tls_connection_get_certificate ()">g_tls_connection_get_certificate</a>    (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>);
55 <a class="link" href="GTlsCertificate.html" title="GTlsCertificate"><span class="returnvalue">GTlsCertificate</span></a> *   <a class="link" href="GTlsConnection.html#g-tls-connection-get-peer-certificate" title="g_tls_connection_get_peer_certificate ()">g_tls_connection_get_peer_certificate</a>
56                                                         (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>);
57 <a class="link" href="gio-TLS-Overview.html#GTlsCertificateFlags"><span class="returnvalue">GTlsCertificateFlags</span></a> <a class="link" href="GTlsConnection.html#g-tls-connection-get-peer-certificate-errors" title="g_tls_connection_get_peer_certificate_errors ()">g_tls_connection_get_peer_certificate_errors</a>
58                                                         (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>);
59 <span class="returnvalue">void</span>                <a class="link" href="GTlsConnection.html#g-tls-connection-set-require-close-notify" title="g_tls_connection_set_require_close_notify ()">g_tls_connection_set_require_close_notify</a>
60                                                         (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
61                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> require_close_notify</code></em>);
62 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GTlsConnection.html#g-tls-connection-get-require-close-notify" title="g_tls_connection_get_require_close_notify ()">g_tls_connection_get_require_close_notify</a>
63                                                         (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>);
64 enum                <a class="link" href="GTlsConnection.html#GTlsRehandshakeMode" title="enum GTlsRehandshakeMode">GTlsRehandshakeMode</a>;
65 <span class="returnvalue">void</span>                <a class="link" href="GTlsConnection.html#g-tls-connection-set-rehandshake-mode" title="g_tls_connection_set_rehandshake_mode ()">g_tls_connection_set_rehandshake_mode</a>
66                                                         (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
67                                                          <em class="parameter"><code><a class="link" href="GTlsConnection.html#GTlsRehandshakeMode" title="enum GTlsRehandshakeMode"><span class="type">GTlsRehandshakeMode</span></a> mode</code></em>);
68 <a class="link" href="GTlsConnection.html#GTlsRehandshakeMode" title="enum GTlsRehandshakeMode"><span class="returnvalue">GTlsRehandshakeMode</span></a> <a class="link" href="GTlsConnection.html#g-tls-connection-get-rehandshake-mode" title="g_tls_connection_get_rehandshake_mode ()">g_tls_connection_get_rehandshake_mode</a>
69                                                         (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>);
70 <span class="returnvalue">void</span>                <a class="link" href="GTlsConnection.html#g-tls-connection-set-use-system-certdb" title="g_tls_connection_set_use_system_certdb ()">g_tls_connection_set_use_system_certdb</a>
71                                                         (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
72                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> use_system_certdb</code></em>);
73 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GTlsConnection.html#g-tls-connection-get-use-system-certdb" title="g_tls_connection_get_use_system_certdb ()">g_tls_connection_get_use_system_certdb</a>
74                                                         (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>);
75 <a class="link" href="GTlsDatabase.html" title="GTlsDatabase"><span class="returnvalue">GTlsDatabase</span></a> *      <a class="link" href="GTlsConnection.html#g-tls-connection-get-database" title="g_tls_connection_get_database ()">g_tls_connection_get_database</a>       (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>);
76 <span class="returnvalue">void</span>                <a class="link" href="GTlsConnection.html#g-tls-connection-set-database" title="g_tls_connection_set_database ()">g_tls_connection_set_database</a>       (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
77                                                          <em class="parameter"><code><a class="link" href="GTlsDatabase.html" title="GTlsDatabase"><span class="type">GTlsDatabase</span></a> *database</code></em>);
78 <a class="link" href="GTlsInteraction.html" title="GTlsInteraction"><span class="returnvalue">GTlsInteraction</span></a> *   <a class="link" href="GTlsConnection.html#g-tls-connection-get-interaction" title="g_tls_connection_get_interaction ()">g_tls_connection_get_interaction</a>    (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>);
79 <span class="returnvalue">void</span>                <a class="link" href="GTlsConnection.html#g-tls-connection-set-interaction" title="g_tls_connection_set_interaction ()">g_tls_connection_set_interaction</a>    (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
80                                                          <em class="parameter"><code><a class="link" href="GTlsInteraction.html" title="GTlsInteraction"><span class="type">GTlsInteraction</span></a> *interaction</code></em>);
81
82 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GTlsConnection.html#g-tls-connection-handshake" title="g_tls_connection_handshake ()">g_tls_connection_handshake</a>          (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
83                                                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
84                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
85 <span class="returnvalue">void</span>                <a class="link" href="GTlsConnection.html#g-tls-connection-handshake-async" title="g_tls_connection_handshake_async ()">g_tls_connection_handshake_async</a>    (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
86                                                          <em class="parameter"><code><span class="type">int</span> io_priority</code></em>,
87                                                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
88                                                          <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
89                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);
90 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GTlsConnection.html#g-tls-connection-handshake-finish" title="g_tls_connection_handshake_finish ()">g_tls_connection_handshake_finish</a>   (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
91                                                          <em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *result</code></em>,
92                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
93
94 <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="GTlsConnection.html#g-tls-connection-emit-accept-certificate" title="g_tls_connection_emit_accept_certificate ()">g_tls_connection_emit_accept_certificate</a>
95                                                         (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
96                                                          <em class="parameter"><code><a class="link" href="GTlsCertificate.html" title="GTlsCertificate"><span class="type">GTlsCertificate</span></a> *peer_cert</code></em>,
97                                                          <em class="parameter"><code><a class="link" href="gio-TLS-Overview.html#GTlsCertificateFlags"><span class="type">GTlsCertificateFlags</span></a> errors</code></em>);
98 </pre>
99 </div>
100 <div class="refsect1">
101 <a name="GTlsConnection.object-hierarchy"></a><h2>Object Hierarchy</h2>
102 <pre class="synopsis">
103   <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#GObject">GObject</a>
104    +----<a class="link" href="GIOStream.html" title="GIOStream">GIOStream</a>
105          +----GTlsConnection
106 </pre>
107 </div>
108 <div class="refsect1">
109 <a name="GTlsConnection.derived-interfaces"></a><h2>Known Derived Interfaces</h2>
110 <p>
111 GTlsConnection is required by
112  <a class="link" href="GTlsClientConnection.html" title="GTlsClientConnection">GTlsClientConnection</a> and  <a class="link" href="GTlsServerConnection.html" title="GTlsServerConnection">GTlsServerConnection</a>.</p>
113 </div>
114 <div class="refsect1">
115 <a name="GTlsConnection.properties"></a><h2>Properties</h2>
116 <pre class="synopsis">
117   "<a class="link" href="GTlsConnection.html#GTlsConnection--base-io-stream" title='The "base-io-stream" property'>base-io-stream</a>"           <a class="link" href="GIOStream.html" title="GIOStream"><span class="type">GIOStream</span></a>*            : Read / Write / Construct Only
118   "<a class="link" href="GTlsConnection.html#GTlsConnection--certificate" title='The "certificate" property'>certificate</a>"              <a class="link" href="GTlsCertificate.html" title="GTlsCertificate"><span class="type">GTlsCertificate</span></a>*      : Read / Write
119   "<a class="link" href="GTlsConnection.html#GTlsConnection--database" title='The "database" property'>database</a>"                 <a class="link" href="GTlsDatabase.html" title="GTlsDatabase"><span class="type">GTlsDatabase</span></a>*         : Read / Write
120   "<a class="link" href="GTlsConnection.html#GTlsConnection--interaction" title='The "interaction" property'>interaction</a>"              <a class="link" href="GTlsInteraction.html" title="GTlsInteraction"><span class="type">GTlsInteraction</span></a>*      : Read / Write
121   "<a class="link" href="GTlsConnection.html#GTlsConnection--peer-certificate" title='The "peer-certificate" property'>peer-certificate</a>"         <a class="link" href="GTlsCertificate.html" title="GTlsCertificate"><span class="type">GTlsCertificate</span></a>*      : Read
122   "<a class="link" href="GTlsConnection.html#GTlsConnection--peer-certificate-errors" title='The "peer-certificate-errors" property'>peer-certificate-errors</a>"  <a class="link" href="gio-TLS-Overview.html#GTlsCertificateFlags"><span class="type">GTlsCertificateFlags</span></a>  : Read
123   "<a class="link" href="GTlsConnection.html#GTlsConnection--rehandshake-mode" title='The "rehandshake-mode" property'>rehandshake-mode</a>"         <a class="link" href="GTlsConnection.html#GTlsRehandshakeMode" title="enum GTlsRehandshakeMode"><span class="type">GTlsRehandshakeMode</span></a>   : Read / Write / Construct
124   "<a class="link" href="GTlsConnection.html#GTlsConnection--require-close-notify" title='The "require-close-notify" property'>require-close-notify</a>"     <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write / Construct
125   "<a class="link" href="GTlsConnection.html#GTlsConnection--use-system-certdb" title='The "use-system-certdb" property'>use-system-certdb</a>"        <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write / Construct
126 </pre>
127 </div>
128 <div class="refsect1">
129 <a name="GTlsConnection.signals"></a><h2>Signals</h2>
130 <pre class="synopsis">
131   "<a class="link" href="GTlsConnection.html#GTlsConnection-accept-certificate" title='The "accept-certificate" signal'>accept-certificate</a>"                             : <a href="./../gobject/gobject/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a>
132 </pre>
133 </div>
134 <div class="refsect1">
135 <a name="GTlsConnection.description"></a><h2>Description</h2>
136 <p>
137 <a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> is the base TLS connection class type, which wraps
138 a <a class="link" href="GIOStream.html" title="GIOStream"><span class="type">GIOStream</span></a> and provides TLS encryption on top of it. Its
139 subclasses, <a class="link" href="GTlsClientConnection.html" title="GTlsClientConnection"><span class="type">GTlsClientConnection</span></a> and <a class="link" href="GTlsServerConnection.html" title="GTlsServerConnection"><span class="type">GTlsServerConnection</span></a>,
140 implement client-side and server-side TLS, respectively.
141 </p>
142 </div>
143 <div class="refsect1">
144 <a name="GTlsConnection.details"></a><h2>Details</h2>
145 <div class="refsect2">
146 <a name="GTlsConnection-struct"></a><h3>GTlsConnection</h3>
147 <pre class="programlisting">typedef struct _GTlsConnection GTlsConnection;</pre>
148 <p>
149 Abstract base class for the backend-specific <a class="link" href="GTlsClientConnection.html" title="GTlsClientConnection"><span class="type">GTlsClientConnection</span></a>
150 and <a class="link" href="GTlsServerConnection.html" title="GTlsServerConnection"><span class="type">GTlsServerConnection</span></a> types.
151 </p>
152 <p class="since">Since 2.28</p>
153 </div>
154 <hr>
155 <div class="refsect2">
156 <a name="g-tls-connection-set-certificate"></a><h3>g_tls_connection_set_certificate ()</h3>
157 <pre class="programlisting"><span class="returnvalue">void</span>                g_tls_connection_set_certificate    (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
158                                                          <em class="parameter"><code><a class="link" href="GTlsCertificate.html" title="GTlsCertificate"><span class="type">GTlsCertificate</span></a> *certificate</code></em>);</pre>
159 <p>
160 This sets the certificate that <em class="parameter"><code>conn</code></em> will present to its peer
161 during the TLS handshake. For a <a class="link" href="GTlsServerConnection.html" title="GTlsServerConnection"><span class="type">GTlsServerConnection</span></a>, it is
162 mandatory to set this, and that will normally be done at construct
163 time.
164 </p>
165 <p>
166 For a <a class="link" href="GTlsClientConnection.html" title="GTlsClientConnection"><span class="type">GTlsClientConnection</span></a>, this is optional. If a handshake fails
167 with <a class="link" href="gio-TLS-Overview.html#G-TLS-ERROR-CERTIFICATE-REQUIRED:CAPS"><code class="literal">G_TLS_ERROR_CERTIFICATE_REQUIRED</code></a>, that means that the server
168 requires a certificate, and if you try connecting again, you should
169 call this method first. You can call
170 <a class="link" href="GTlsClientConnection.html#g-tls-client-connection-get-accepted-cas" title="g_tls_client_connection_get_accepted_cas ()"><code class="function">g_tls_client_connection_get_accepted_cas()</code></a> on the failed connection
171 to get a list of Certificate Authorities that the server will
172 accept certificates from.
173 </p>
174 <p>
175 (It is also possible that a server will allow the connection with
176 or without a certificate; in that case, if you don't provide a
177 certificate, you can tell that the server requested one by the fact
178 that <a class="link" href="GTlsClientConnection.html#g-tls-client-connection-get-accepted-cas" title="g_tls_client_connection_get_accepted_cas ()"><code class="function">g_tls_client_connection_get_accepted_cas()</code></a> will return
179 non-<a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.)
180 </p>
181 <div class="variablelist"><table border="0">
182 <col align="left" valign="top">
183 <tbody>
184 <tr>
185 <td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
186 <td>a <a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
187 </td>
188 </tr>
189 <tr>
190 <td><p><span class="term"><em class="parameter"><code>certificate</code></em> :</span></p></td>
191 <td>the certificate to use for <em class="parameter"><code>conn</code></em>
192 </td>
193 </tr>
194 </tbody>
195 </table></div>
196 <p class="since">Since 2.28</p>
197 </div>
198 <hr>
199 <div class="refsect2">
200 <a name="g-tls-connection-get-certificate"></a><h3>g_tls_connection_get_certificate ()</h3>
201 <pre class="programlisting"><a class="link" href="GTlsCertificate.html" title="GTlsCertificate"><span class="returnvalue">GTlsCertificate</span></a> *   g_tls_connection_get_certificate    (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>);</pre>
202 <p>
203 Gets <em class="parameter"><code>conn</code></em>'s certificate, as set by
204 <a class="link" href="GTlsConnection.html#g-tls-connection-set-certificate" title="g_tls_connection_set_certificate ()"><code class="function">g_tls_connection_set_certificate()</code></a>.
205 </p>
206 <div class="variablelist"><table border="0">
207 <col align="left" valign="top">
208 <tbody>
209 <tr>
210 <td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
211 <td>a <a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
212 </td>
213 </tr>
214 <tr>
215 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
216 <td>
217 <em class="parameter"><code>conn</code></em>'s certificate, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
218 </td>
219 </tr>
220 </tbody>
221 </table></div>
222 <p class="since">Since 2.28</p>
223 </div>
224 <hr>
225 <div class="refsect2">
226 <a name="g-tls-connection-get-peer-certificate"></a><h3>g_tls_connection_get_peer_certificate ()</h3>
227 <pre class="programlisting"><a class="link" href="GTlsCertificate.html" title="GTlsCertificate"><span class="returnvalue">GTlsCertificate</span></a> *   g_tls_connection_get_peer_certificate
228                                                         (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>);</pre>
229 <p>
230 Gets <em class="parameter"><code>conn</code></em>'s peer's certificate after the handshake has completed.
231 (It is not set during the emission of
232 <a class="link" href="GTlsConnection.html#GTlsConnection-accept-certificate" title='The "accept-certificate" signal'><span class="type">"accept-certificate"</span></a>.)
233 </p>
234 <div class="variablelist"><table border="0">
235 <col align="left" valign="top">
236 <tbody>
237 <tr>
238 <td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
239 <td>a <a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
240 </td>
241 </tr>
242 <tr>
243 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
244 <td>
245 <em class="parameter"><code>conn</code></em>'s peer's certificate, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
246 </td>
247 </tr>
248 </tbody>
249 </table></div>
250 <p class="since">Since 2.28</p>
251 </div>
252 <hr>
253 <div class="refsect2">
254 <a name="g-tls-connection-get-peer-certificate-errors"></a><h3>g_tls_connection_get_peer_certificate_errors ()</h3>
255 <pre class="programlisting"><a class="link" href="gio-TLS-Overview.html#GTlsCertificateFlags"><span class="returnvalue">GTlsCertificateFlags</span></a> g_tls_connection_get_peer_certificate_errors
256                                                         (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>);</pre>
257 <p>
258 Gets the errors associated with validating <em class="parameter"><code>conn</code></em>'s peer's
259 certificate, after the handshake has completed. (It is not set
260 during the emission of <a class="link" href="GTlsConnection.html#GTlsConnection-accept-certificate" title='The "accept-certificate" signal'><span class="type">"accept-certificate"</span></a>.)
261 </p>
262 <div class="variablelist"><table border="0">
263 <col align="left" valign="top">
264 <tbody>
265 <tr>
266 <td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
267 <td>a <a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
268 </td>
269 </tr>
270 <tr>
271 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
272 <td>
273 <em class="parameter"><code>conn</code></em>'s peer's certificate errors</td>
274 </tr>
275 </tbody>
276 </table></div>
277 <p class="since">Since 2.28</p>
278 </div>
279 <hr>
280 <div class="refsect2">
281 <a name="g-tls-connection-set-require-close-notify"></a><h3>g_tls_connection_set_require_close_notify ()</h3>
282 <pre class="programlisting"><span class="returnvalue">void</span>                g_tls_connection_set_require_close_notify
283                                                         (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
284                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> require_close_notify</code></em>);</pre>
285 <p>
286 Sets whether or not <em class="parameter"><code>conn</code></em> expects a proper TLS close notification
287 before the connection is closed. If this is <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> (the default),
288 then <em class="parameter"><code>conn</code></em> will expect to receive a TLS close notification from its
289 peer before the connection is closed, and will return a
290 <a class="link" href="gio-TLS-Overview.html#G-TLS-ERROR-EOF:CAPS"><code class="literal">G_TLS_ERROR_EOF</code></a> error if the connection is closed without proper
291 notification (since this may indicate a network error, or
292 man-in-the-middle attack).
293 </p>
294 <p>
295 In some protocols, the application will know whether or not the
296 connection was closed cleanly based on application-level data
297 (because the application-level data includes a length field, or is
298 somehow self-delimiting); in this case, the close notify is
299 redundant and sometimes omitted. (TLS 1.1 explicitly allows this;
300 in TLS 1.0 it is technically an error, but often done anyway.) You
301 can use <a class="link" href="GTlsConnection.html#g-tls-connection-set-require-close-notify" title="g_tls_connection_set_require_close_notify ()"><code class="function">g_tls_connection_set_require_close_notify()</code></a> to tell <em class="parameter"><code>conn</code></em>
302 to allow an "unannounced" connection close, in which case the close
303 will show up as a 0-length read, as in a non-TLS
304 <a class="link" href="GSocketConnection.html" title="GSocketConnection"><span class="type">GSocketConnection</span></a>, and it is up to the application to check that
305 the data has been fully received.
306 </p>
307 <p>
308 Note that this only affects the behavior when the peer closes the
309 connection; when the application calls <a class="link" href="GIOStream.html#g-io-stream-close" title="g_io_stream_close ()"><code class="function">g_io_stream_close()</code></a> itself
310 on <em class="parameter"><code>conn</code></em>, this will send a close notification regardless of the
311 setting of this property. If you explicitly want to do an unclean
312 close, you can close <em class="parameter"><code>conn</code></em>'s <a class="link" href="GTlsConnection.html#GTlsConnection--base-io-stream" title='The "base-io-stream" property'><span class="type">"base-io-stream"</span></a> rather
313 than closing <em class="parameter"><code>conn</code></em> itself.
314 </p>
315 <div class="variablelist"><table border="0">
316 <col align="left" valign="top">
317 <tbody>
318 <tr>
319 <td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
320 <td>a <a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
321 </td>
322 </tr>
323 <tr>
324 <td><p><span class="term"><em class="parameter"><code>require_close_notify</code></em> :</span></p></td>
325 <td>whether or not to require close notification</td>
326 </tr>
327 </tbody>
328 </table></div>
329 <p class="since">Since 2.28</p>
330 </div>
331 <hr>
332 <div class="refsect2">
333 <a name="g-tls-connection-get-require-close-notify"></a><h3>g_tls_connection_get_require_close_notify ()</h3>
334 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_tls_connection_get_require_close_notify
335                                                         (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>);</pre>
336 <p>
337 Tests whether or not <em class="parameter"><code>conn</code></em> expects a proper TLS close notification
338 when the connection is closed. See
339 <a class="link" href="GTlsConnection.html#g-tls-connection-set-require-close-notify" title="g_tls_connection_set_require_close_notify ()"><code class="function">g_tls_connection_set_require_close_notify()</code></a> for details.
340 </p>
341 <div class="variablelist"><table border="0">
342 <col align="left" valign="top">
343 <tbody>
344 <tr>
345 <td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
346 <td>a <a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
347 </td>
348 </tr>
349 <tr>
350 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
351 <td>
352 <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if <em class="parameter"><code>conn</code></em> requires a proper TLS close
353 notification.</td>
354 </tr>
355 </tbody>
356 </table></div>
357 <p class="since">Since 2.28</p>
358 </div>
359 <hr>
360 <div class="refsect2">
361 <a name="GTlsRehandshakeMode"></a><h3>enum GTlsRehandshakeMode</h3>
362 <pre class="programlisting">typedef enum {
363   G_TLS_REHANDSHAKE_NEVER,
364   G_TLS_REHANDSHAKE_SAFELY,
365   G_TLS_REHANDSHAKE_UNSAFELY
366 } GTlsRehandshakeMode;
367 </pre>
368 <p>
369 When to allow rehandshaking. See
370 <a class="link" href="GTlsConnection.html#g-tls-connection-set-rehandshake-mode" title="g_tls_connection_set_rehandshake_mode ()"><code class="function">g_tls_connection_set_rehandshake_mode()</code></a>.
371 </p>
372 <div class="variablelist"><table border="0">
373 <col align="left" valign="top">
374 <tbody>
375 <tr>
376 <td><p><a name="G-TLS-REHANDSHAKE-NEVER:CAPS"></a><span class="term"><code class="literal">G_TLS_REHANDSHAKE_NEVER</code></span></p></td>
377 <td>Never allow rehandshaking
378 </td>
379 </tr>
380 <tr>
381 <td><p><a name="G-TLS-REHANDSHAKE-SAFELY:CAPS"></a><span class="term"><code class="literal">G_TLS_REHANDSHAKE_SAFELY</code></span></p></td>
382 <td>Allow safe rehandshaking only
383 </td>
384 </tr>
385 <tr>
386 <td><p><a name="G-TLS-REHANDSHAKE-UNSAFELY:CAPS"></a><span class="term"><code class="literal">G_TLS_REHANDSHAKE_UNSAFELY</code></span></p></td>
387 <td>Allow unsafe rehandshaking
388 </td>
389 </tr>
390 </tbody>
391 </table></div>
392 <p class="since">Since 2.28</p>
393 </div>
394 <hr>
395 <div class="refsect2">
396 <a name="g-tls-connection-set-rehandshake-mode"></a><h3>g_tls_connection_set_rehandshake_mode ()</h3>
397 <pre class="programlisting"><span class="returnvalue">void</span>                g_tls_connection_set_rehandshake_mode
398                                                         (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
399                                                          <em class="parameter"><code><a class="link" href="GTlsConnection.html#GTlsRehandshakeMode" title="enum GTlsRehandshakeMode"><span class="type">GTlsRehandshakeMode</span></a> mode</code></em>);</pre>
400 <p>
401 Sets how <em class="parameter"><code>conn</code></em> behaves with respect to rehandshaking requests.
402 </p>
403 <p>
404 <a class="link" href="GTlsConnection.html#G-TLS-REHANDSHAKE-NEVER:CAPS"><code class="literal">G_TLS_REHANDSHAKE_NEVER</code></a> means that it will never agree to
405 rehandshake after the initial handshake is complete. (For a client,
406 this means it will refuse rehandshake requests from the server, and
407 for a server, this means it will close the connection with an error
408 if the client attempts to rehandshake.)
409 </p>
410 <p>
411 <a class="link" href="GTlsConnection.html#G-TLS-REHANDSHAKE-SAFELY:CAPS"><code class="literal">G_TLS_REHANDSHAKE_SAFELY</code></a> means that the connection will allow a
412 rehandshake only if the other end of the connection supports the
413 TLS <code class="literal">renegotiation_info</code> extension. This is the
414 default behavior, but means that rehandshaking will not work
415 against older implementations that do not support that extension.
416 </p>
417 <p>
418 <a class="link" href="GTlsConnection.html#G-TLS-REHANDSHAKE-UNSAFELY:CAPS"><code class="literal">G_TLS_REHANDSHAKE_UNSAFELY</code></a> means that the connection will allow
419 rehandshaking even without the
420 <code class="literal">renegotiation_info</code> extension. On the server side
421 in particular, this is not recommended, since it leaves the server
422 open to certain attacks. However, this mode is necessary if you
423 need to allow renegotiation with older client software.
424 </p>
425 <div class="variablelist"><table border="0">
426 <col align="left" valign="top">
427 <tbody>
428 <tr>
429 <td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
430 <td>a <a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
431 </td>
432 </tr>
433 <tr>
434 <td><p><span class="term"><em class="parameter"><code>mode</code></em> :</span></p></td>
435 <td>the rehandshaking mode</td>
436 </tr>
437 </tbody>
438 </table></div>
439 <p class="since">Since 2.28</p>
440 </div>
441 <hr>
442 <div class="refsect2">
443 <a name="g-tls-connection-get-rehandshake-mode"></a><h3>g_tls_connection_get_rehandshake_mode ()</h3>
444 <pre class="programlisting"><a class="link" href="GTlsConnection.html#GTlsRehandshakeMode" title="enum GTlsRehandshakeMode"><span class="returnvalue">GTlsRehandshakeMode</span></a> g_tls_connection_get_rehandshake_mode
445                                                         (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>);</pre>
446 <p>
447 Gets <em class="parameter"><code>conn</code></em> rehandshaking mode. See
448 <a class="link" href="GTlsConnection.html#g-tls-connection-set-rehandshake-mode" title="g_tls_connection_set_rehandshake_mode ()"><code class="function">g_tls_connection_set_rehandshake_mode()</code></a> for details.
449 </p>
450 <div class="variablelist"><table border="0">
451 <col align="left" valign="top">
452 <tbody>
453 <tr>
454 <td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
455 <td>a <a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
456 </td>
457 </tr>
458 <tr>
459 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
460 <td>
461 <em class="parameter"><code>conn</code></em>'s rehandshaking mode</td>
462 </tr>
463 </tbody>
464 </table></div>
465 <p class="since">Since 2.28</p>
466 </div>
467 <hr>
468 <div class="refsect2">
469 <a name="g-tls-connection-set-use-system-certdb"></a><h3>g_tls_connection_set_use_system_certdb ()</h3>
470 <pre class="programlisting"><span class="returnvalue">void</span>                g_tls_connection_set_use_system_certdb
471                                                         (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
472                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a> use_system_certdb</code></em>);</pre>
473 <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
474 <h3 class="title">Warning</h3>
475 <p><code class="literal">g_tls_connection_set_use_system_certdb</code> has been deprecated since version 2.30 and should not be used in newly-written code. Use <a class="link" href="GTlsConnection.html#g-tls-connection-set-database" title="g_tls_connection_set_database ()"><code class="function">g_tls_connection_set_database()</code></a> instead</p>
476 </div>
477 <p>
478 Sets whether <em class="parameter"><code>conn</code></em> uses the system certificate database to verify
479 peer certificates. This is <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> by default. If set to <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a>, then
480 peer certificate validation will always set the
481 <a class="link" href="gio-TLS-Overview.html#G-TLS-CERTIFICATE-UNKNOWN-CA:CAPS"><code class="literal">G_TLS_CERTIFICATE_UNKNOWN_CA</code></a> error (meaning
482 <a class="link" href="GTlsConnection.html#GTlsConnection-accept-certificate" title='The "accept-certificate" signal'><span class="type">"accept-certificate"</span></a> will always be emitted on
483 client-side connections, unless that bit is not set in
484 <a class="link" href="GTlsClientConnection.html#GTlsClientConnection--validation-flags" title='The "validation-flags" property'><span class="type">"validation-flags"</span></a>).
485 </p>
486 <div class="variablelist"><table border="0">
487 <col align="left" valign="top">
488 <tbody>
489 <tr>
490 <td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
491 <td>a <a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
492 </td>
493 </tr>
494 <tr>
495 <td><p><span class="term"><em class="parameter"><code>use_system_certdb</code></em> :</span></p></td>
496 <td>whether to use the system certificate database</td>
497 </tr>
498 </tbody>
499 </table></div>
500 </div>
501 <hr>
502 <div class="refsect2">
503 <a name="g-tls-connection-get-use-system-certdb"></a><h3>g_tls_connection_get_use_system_certdb ()</h3>
504 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_tls_connection_get_use_system_certdb
505                                                         (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>);</pre>
506 <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
507 <h3 class="title">Warning</h3>
508 <p><code class="literal">g_tls_connection_get_use_system_certdb</code> has been deprecated since version 2.30 and should not be used in newly-written code. Use <a class="link" href="GTlsConnection.html#g-tls-connection-get-database" title="g_tls_connection_get_database ()"><code class="function">g_tls_connection_get_database()</code></a> instead</p>
509 </div>
510 <p>
511 Gets whether <em class="parameter"><code>conn</code></em> uses the system certificate database to verify
512 peer certificates. See <a class="link" href="GTlsConnection.html#g-tls-connection-set-use-system-certdb" title="g_tls_connection_set_use_system_certdb ()"><code class="function">g_tls_connection_set_use_system_certdb()</code></a>.
513 </p>
514 <div class="variablelist"><table border="0">
515 <col align="left" valign="top">
516 <tbody>
517 <tr>
518 <td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
519 <td>a <a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
520 </td>
521 </tr>
522 <tr>
523 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
524 <td>whether <em class="parameter"><code>conn</code></em> uses the system certificate database</td>
525 </tr>
526 </tbody>
527 </table></div>
528 </div>
529 <hr>
530 <div class="refsect2">
531 <a name="g-tls-connection-get-database"></a><h3>g_tls_connection_get_database ()</h3>
532 <pre class="programlisting"><a class="link" href="GTlsDatabase.html" title="GTlsDatabase"><span class="returnvalue">GTlsDatabase</span></a> *      g_tls_connection_get_database       (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>);</pre>
533 <p>
534 Gets the certificate database that <em class="parameter"><code>conn</code></em> uses to verify
535 peer certificates. See <a class="link" href="GTlsConnection.html#g-tls-connection-set-database" title="g_tls_connection_set_database ()"><code class="function">g_tls_connection_set_database()</code></a>.
536 </p>
537 <div class="variablelist"><table border="0">
538 <col align="left" valign="top">
539 <tbody>
540 <tr>
541 <td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
542 <td>a <a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
543 </td>
544 </tr>
545 <tr>
546 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
547 <td>the certificate database that <em class="parameter"><code>conn</code></em> uses or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
548 </td>
549 </tr>
550 </tbody>
551 </table></div>
552 <p class="since">Since 2.30</p>
553 </div>
554 <hr>
555 <div class="refsect2">
556 <a name="g-tls-connection-set-database"></a><h3>g_tls_connection_set_database ()</h3>
557 <pre class="programlisting"><span class="returnvalue">void</span>                g_tls_connection_set_database       (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
558                                                          <em class="parameter"><code><a class="link" href="GTlsDatabase.html" title="GTlsDatabase"><span class="type">GTlsDatabase</span></a> *database</code></em>);</pre>
559 <p>
560 Sets the certificate database that is used to verify peer certificates.
561 This is set to the default database by default. See
562 <a class="link" href="GTlsBackend.html#g-tls-backend-get-default-database" title="g_tls_backend_get_default_database ()"><code class="function">g_tls_backend_get_default_database()</code></a>. If set to <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, then
563 peer certificate validation will always set the
564 <a class="link" href="gio-TLS-Overview.html#G-TLS-CERTIFICATE-UNKNOWN-CA:CAPS"><code class="literal">G_TLS_CERTIFICATE_UNKNOWN_CA</code></a> error (meaning
565 <a class="link" href="GTlsConnection.html#GTlsConnection-accept-certificate" title='The "accept-certificate" signal'><span class="type">"accept-certificate"</span></a> will always be emitted on
566 client-side connections, unless that bit is not set in
567 <a class="link" href="GTlsClientConnection.html#GTlsClientConnection--validation-flags" title='The "validation-flags" property'><span class="type">"validation-flags"</span></a>).
568 </p>
569 <div class="variablelist"><table border="0">
570 <col align="left" valign="top">
571 <tbody>
572 <tr>
573 <td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
574 <td>a <a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
575 </td>
576 </tr>
577 <tr>
578 <td><p><span class="term"><em class="parameter"><code>database</code></em> :</span></p></td>
579 <td>a <a class="link" href="GTlsDatabase.html" title="GTlsDatabase"><span class="type">GTlsDatabase</span></a>
580 </td>
581 </tr>
582 </tbody>
583 </table></div>
584 <p class="since">Since 2.30</p>
585 </div>
586 <hr>
587 <div class="refsect2">
588 <a name="g-tls-connection-get-interaction"></a><h3>g_tls_connection_get_interaction ()</h3>
589 <pre class="programlisting"><a class="link" href="GTlsInteraction.html" title="GTlsInteraction"><span class="returnvalue">GTlsInteraction</span></a> *   g_tls_connection_get_interaction    (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>);</pre>
590 <p>
591 Get the object that will be used to interact with the user. It will be used
592 for things like prompting the user for passwords. If <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is returned, then
593 no user interaction will occur for this connection.
594 </p>
595 <div class="variablelist"><table border="0">
596 <col align="left" valign="top">
597 <tbody>
598 <tr>
599 <td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
600 <td>a connection</td>
601 </tr>
602 <tr>
603 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
604 <td>The interaction object. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
605 </td>
606 </tr>
607 </tbody>
608 </table></div>
609 <p class="since">Since 2.30</p>
610 </div>
611 <hr>
612 <div class="refsect2">
613 <a name="g-tls-connection-set-interaction"></a><h3>g_tls_connection_set_interaction ()</h3>
614 <pre class="programlisting"><span class="returnvalue">void</span>                g_tls_connection_set_interaction    (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
615                                                          <em class="parameter"><code><a class="link" href="GTlsInteraction.html" title="GTlsInteraction"><span class="type">GTlsInteraction</span></a> *interaction</code></em>);</pre>
616 <p>
617 Set the object that will be used to interact with the user. It will be used
618 for things like prompting the user for passwords.
619 </p>
620 <p>
621 The <em class="parameter"><code>interaction</code></em> argument will normally be a derived subclass of
622 <a class="link" href="GTlsInteraction.html" title="GTlsInteraction"><span class="type">GTlsInteraction</span></a>. <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> can also be provided if no user interaction
623 should occur for this connection.
624 </p>
625 <div class="variablelist"><table border="0">
626 <col align="left" valign="top">
627 <tbody>
628 <tr>
629 <td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
630 <td>a connection</td>
631 </tr>
632 <tr>
633 <td><p><span class="term"><em class="parameter"><code>interaction</code></em> :</span></p></td>
634 <td>an interaction object, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
635 </td>
636 </tr>
637 </tbody>
638 </table></div>
639 <p class="since">Since 2.30</p>
640 </div>
641 <hr>
642 <div class="refsect2">
643 <a name="g-tls-connection-handshake"></a><h3>g_tls_connection_handshake ()</h3>
644 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_tls_connection_handshake          (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
645                                                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
646                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
647 <p>
648 Attempts a TLS handshake on <em class="parameter"><code>conn</code></em>.
649 </p>
650 <p>
651 On the client side, it is never necessary to call this method;
652 although the connection needs to perform a handshake after
653 connecting (or after sending a "STARTTLS"-type command) and may
654 need to rehandshake later if the server requests it,
655 <a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> will handle this for you automatically when you try
656 to send or receive data on the connection. However, you can call
657 <a class="link" href="GTlsConnection.html#g-tls-connection-handshake" title="g_tls_connection_handshake ()"><code class="function">g_tls_connection_handshake()</code></a> manually if you want to know for sure
658 whether the initial handshake succeeded or failed (as opposed to
659 just immediately trying to write to <em class="parameter"><code>conn</code></em>'s output stream, in which
660 case if it fails, it may not be possible to tell if it failed
661 before or after completing the handshake).
662 </p>
663 <p>
664 Likewise, on the server side, although a handshake is necessary at
665 the beginning of the communication, you do not need to call this
666 function explicitly unless you want clearer error reporting.
667 However, you may call <a class="link" href="GTlsConnection.html#g-tls-connection-handshake" title="g_tls_connection_handshake ()"><code class="function">g_tls_connection_handshake()</code></a> later on to
668 renegotiate parameters (encryption methods, etc) with the client.
669 </p>
670 <p>
671 <a class="link" href="GTlsConnection.html#GTlsConnection-accept-certificate" title='The "accept-certificate" signal'><span class="type">"accept_certificate"</span></a> may be emitted during the
672 handshake.
673 </p>
674 <div class="variablelist"><table border="0">
675 <col align="left" valign="top">
676 <tbody>
677 <tr>
678 <td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
679 <td>a <a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
680 </td>
681 </tr>
682 <tr>
683 <td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
684 <td>a <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a>, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
685 </td>
686 </tr>
687 <tr>
688 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
689 <td>a <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
690 </td>
691 </tr>
692 <tr>
693 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
694 <td>success or failure</td>
695 </tr>
696 </tbody>
697 </table></div>
698 <p class="since">Since 2.28</p>
699 </div>
700 <hr>
701 <div class="refsect2">
702 <a name="g-tls-connection-handshake-async"></a><h3>g_tls_connection_handshake_async ()</h3>
703 <pre class="programlisting"><span class="returnvalue">void</span>                g_tls_connection_handshake_async    (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
704                                                          <em class="parameter"><code><span class="type">int</span> io_priority</code></em>,
705                                                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
706                                                          <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
707                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
708 <p>
709 Asynchronously performs a TLS handshake on <em class="parameter"><code>conn</code></em>. See
710 <a class="link" href="GTlsConnection.html#g-tls-connection-handshake" title="g_tls_connection_handshake ()"><code class="function">g_tls_connection_handshake()</code></a> for more information.
711 </p>
712 <div class="variablelist"><table border="0">
713 <col align="left" valign="top">
714 <tbody>
715 <tr>
716 <td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
717 <td>a <a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
718 </td>
719 </tr>
720 <tr>
721 <td><p><span class="term"><em class="parameter"><code>io_priority</code></em> :</span></p></td>
722 <td>the <a class="link" href="gio-GIOScheduler.html#io-priority">I/O priority</a>
723 of the request.</td>
724 </tr>
725 <tr>
726 <td><p><span class="term"><em class="parameter"><code>cancellable</code></em> :</span></p></td>
727 <td>a <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a>, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. <span class="annotation">[<acronym title="NULL is ok, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span>
728 </td>
729 </tr>
730 <tr>
731 <td><p><span class="term"><em class="parameter"><code>callback</code></em> :</span></p></td>
732 <td>callback to call when the handshake is complete</td>
733 </tr>
734 <tr>
735 <td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
736 <td>the data to pass to the callback function</td>
737 </tr>
738 </tbody>
739 </table></div>
740 <p class="since">Since 2.28</p>
741 </div>
742 <hr>
743 <div class="refsect2">
744 <a name="g-tls-connection-handshake-finish"></a><h3>g_tls_connection_handshake_finish ()</h3>
745 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_tls_connection_handshake_finish   (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
746                                                          <em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *result</code></em>,
747                                                          <em class="parameter"><code><a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
748 <p>
749 Finish an asynchronous TLS handshake operation. See
750 <a class="link" href="GTlsConnection.html#g-tls-connection-handshake" title="g_tls_connection_handshake ()"><code class="function">g_tls_connection_handshake()</code></a> for more information.
751 </p>
752 <div class="variablelist"><table border="0">
753 <col align="left" valign="top">
754 <tbody>
755 <tr>
756 <td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
757 <td>a <a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
758 </td>
759 </tr>
760 <tr>
761 <td><p><span class="term"><em class="parameter"><code>result</code></em> :</span></p></td>
762 <td>a <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a>.</td>
763 </tr>
764 <tr>
765 <td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
766 <td>a <a href="./../glib/glib/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> pointer, or <a href="./../glib/glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
767 </td>
768 </tr>
769 <tr>
770 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
771 <td>
772 <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success, <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> on failure, in which
773 case <em class="parameter"><code>error</code></em> will be set.</td>
774 </tr>
775 </tbody>
776 </table></div>
777 <p class="since">Since 2.28</p>
778 </div>
779 <hr>
780 <div class="refsect2">
781 <a name="g-tls-connection-emit-accept-certificate"></a><h3>g_tls_connection_emit_accept_certificate ()</h3>
782 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            g_tls_connection_emit_accept_certificate
783                                                         (<em class="parameter"><code><a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> *conn</code></em>,
784                                                          <em class="parameter"><code><a class="link" href="GTlsCertificate.html" title="GTlsCertificate"><span class="type">GTlsCertificate</span></a> *peer_cert</code></em>,
785                                                          <em class="parameter"><code><a class="link" href="gio-TLS-Overview.html#GTlsCertificateFlags"><span class="type">GTlsCertificateFlags</span></a> errors</code></em>);</pre>
786 <p>
787 Used by <a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a> implementations to emit the
788 <a class="link" href="GTlsConnection.html#GTlsConnection-accept-certificate" title='The "accept-certificate" signal'><span class="type">"accept-certificate"</span></a> signal.
789 </p>
790 <div class="variablelist"><table border="0">
791 <col align="left" valign="top">
792 <tbody>
793 <tr>
794 <td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
795 <td>a <a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
796 </td>
797 </tr>
798 <tr>
799 <td><p><span class="term"><em class="parameter"><code>peer_cert</code></em> :</span></p></td>
800 <td>the peer's <a class="link" href="GTlsCertificate.html" title="GTlsCertificate"><span class="type">GTlsCertificate</span></a>
801 </td>
802 </tr>
803 <tr>
804 <td><p><span class="term"><em class="parameter"><code>errors</code></em> :</span></p></td>
805 <td>the problems with <em class="parameter"><code>peer_cert</code></em>
806 </td>
807 </tr>
808 <tr>
809 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
810 <td>
811 <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if one of the signal handlers has returned
812 <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> to accept <em class="parameter"><code>peer_cert</code></em>
813 </td>
814 </tr>
815 </tbody>
816 </table></div>
817 <p class="since">Since 2.28</p>
818 </div>
819 </div>
820 <div class="refsect1">
821 <a name="GTlsConnection.property-details"></a><h2>Property Details</h2>
822 <div class="refsect2">
823 <a name="GTlsConnection--base-io-stream"></a><h3>The <code class="literal">"base-io-stream"</code> property</h3>
824 <pre class="programlisting">  "base-io-stream"           <a class="link" href="GIOStream.html" title="GIOStream"><span class="type">GIOStream</span></a>*            : Read / Write / Construct Only</pre>
825 <p>
826 The <a class="link" href="GIOStream.html" title="GIOStream"><span class="type">GIOStream</span></a> that the connection wraps
827 </p>
828 <p class="since">Since 2.28</p>
829 </div>
830 <hr>
831 <div class="refsect2">
832 <a name="GTlsConnection--certificate"></a><h3>The <code class="literal">"certificate"</code> property</h3>
833 <pre class="programlisting">  "certificate"              <a class="link" href="GTlsCertificate.html" title="GTlsCertificate"><span class="type">GTlsCertificate</span></a>*      : Read / Write</pre>
834 <p>
835 The connection's certificate; see
836 <a class="link" href="GTlsConnection.html#g-tls-connection-set-certificate" title="g_tls_connection_set_certificate ()"><code class="function">g_tls_connection_set_certificate()</code></a>.
837 </p>
838 <p class="since">Since 2.28</p>
839 </div>
840 <hr>
841 <div class="refsect2">
842 <a name="GTlsConnection--database"></a><h3>The <code class="literal">"database"</code> property</h3>
843 <pre class="programlisting">  "database"                 <a class="link" href="GTlsDatabase.html" title="GTlsDatabase"><span class="type">GTlsDatabase</span></a>*         : Read / Write</pre>
844 <p>
845 The certificate database to use when verifying this TLS connection.
846 If no cerificate database is set, then the default database will be
847 used. See <a class="link" href="GTlsBackend.html#g-tls-backend-get-default-database" title="g_tls_backend_get_default_database ()"><code class="function">g_tls_backend_get_default_database()</code></a>.
848 </p>
849 <p class="since">Since 2.30</p>
850 </div>
851 <hr>
852 <div class="refsect2">
853 <a name="GTlsConnection--interaction"></a><h3>The <code class="literal">"interaction"</code> property</h3>
854 <pre class="programlisting">  "interaction"              <a class="link" href="GTlsInteraction.html" title="GTlsInteraction"><span class="type">GTlsInteraction</span></a>*      : Read / Write</pre>
855 <p>
856 A <a class="link" href="GTlsInteraction.html" title="GTlsInteraction"><span class="type">GTlsInteraction</span></a> object to be used when the connection or certificate
857 database need to interact with the user. This will be used to prompt the
858 user for passwords where necessary.
859 </p>
860 <p class="since">Since 2.30</p>
861 </div>
862 <hr>
863 <div class="refsect2">
864 <a name="GTlsConnection--peer-certificate"></a><h3>The <code class="literal">"peer-certificate"</code> property</h3>
865 <pre class="programlisting">  "peer-certificate"         <a class="link" href="GTlsCertificate.html" title="GTlsCertificate"><span class="type">GTlsCertificate</span></a>*      : Read</pre>
866 <p>
867 The connection's peer's certificate, after the TLS handshake has
868 completed and the certificate has been accepted. Note in
869 particular that this is not yet set during the emission of
870 <a class="link" href="GTlsConnection.html#GTlsConnection-accept-certificate" title='The "accept-certificate" signal'><span class="type">"accept-certificate"</span></a>.
871 </p>
872 <p>
873 (You can watch for a <a href="./../gobject/gobject/gobject-The-Base-Object-Type.html#GObject-notify"><span class="type">"notify"</span></a> signal on this property to
874 detect when a handshake has occurred.)
875 </p>
876 <p class="since">Since 2.28</p>
877 </div>
878 <hr>
879 <div class="refsect2">
880 <a name="GTlsConnection--peer-certificate-errors"></a><h3>The <code class="literal">"peer-certificate-errors"</code> property</h3>
881 <pre class="programlisting">  "peer-certificate-errors"  <a class="link" href="gio-TLS-Overview.html#GTlsCertificateFlags"><span class="type">GTlsCertificateFlags</span></a>  : Read</pre>
882 <p>
883 The errors noticed-and-ignored while verifying
884 <a class="link" href="GTlsConnection.html#GTlsConnection--peer-certificate" title='The "peer-certificate" property'><span class="type">"peer-certificate"</span></a>. Normally this should be 0, but
885 it may not be if <a class="link" href="GTlsClientConnection.html#GTlsClientConnection--validation-flags" title='The "validation-flags" property'><span class="type">"validation-flags"</span></a> is not
886 <a class="link" href="gio-TLS-Overview.html#G-TLS-CERTIFICATE-VALIDATE-ALL:CAPS"><code class="literal">G_TLS_CERTIFICATE_VALIDATE_ALL</code></a>, or if
887 <a class="link" href="GTlsConnection.html#GTlsConnection-accept-certificate" title='The "accept-certificate" signal'><span class="type">"accept-certificate"</span></a> overrode the default
888 behavior.
889 </p>
890 <p class="since">Since 2.28</p>
891 </div>
892 <hr>
893 <div class="refsect2">
894 <a name="GTlsConnection--rehandshake-mode"></a><h3>The <code class="literal">"rehandshake-mode"</code> property</h3>
895 <pre class="programlisting">  "rehandshake-mode"         <a class="link" href="GTlsConnection.html#GTlsRehandshakeMode" title="enum GTlsRehandshakeMode"><span class="type">GTlsRehandshakeMode</span></a>   : Read / Write / Construct</pre>
896 <p>
897 The rehandshaking mode. See
898 <a class="link" href="GTlsConnection.html#g-tls-connection-set-rehandshake-mode" title="g_tls_connection_set_rehandshake_mode ()"><code class="function">g_tls_connection_set_rehandshake_mode()</code></a>.
899 </p>
900 <p>Default value: G_TLS_REHANDSHAKE_SAFELY</p>
901 <p class="since">Since 2.28</p>
902 </div>
903 <hr>
904 <div class="refsect2">
905 <a name="GTlsConnection--require-close-notify"></a><h3>The <code class="literal">"require-close-notify"</code> property</h3>
906 <pre class="programlisting">  "require-close-notify"     <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write / Construct</pre>
907 <p>
908 Whether or not proper TLS close notification is required.
909 See <a class="link" href="GTlsConnection.html#g-tls-connection-set-require-close-notify" title="g_tls_connection_set_require_close_notify ()"><code class="function">g_tls_connection_set_require_close_notify()</code></a>.
910 </p>
911 <p>Default value: TRUE</p>
912 <p class="since">Since 2.28</p>
913 </div>
914 <hr>
915 <div class="refsect2">
916 <a name="GTlsConnection--use-system-certdb"></a><h3>The <code class="literal">"use-system-certdb"</code> property</h3>
917 <pre class="programlisting">  "use-system-certdb"        <a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="type">gboolean</span></a>              : Read / Write / Construct</pre>
918 <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
919 <h3 class="title">Warning</h3>
920 <p><code class="literal">GTlsConnection:use-system-certdb</code> has been deprecated since version 2.30 and should not be used in newly-written code. Use GTlsConnection:database instead</p>
921 </div>
922 <p>
923 Whether or not the system certificate database will be used to
924 verify peer certificates. See
925 <a class="link" href="GTlsConnection.html#g-tls-connection-set-use-system-certdb" title="g_tls_connection_set_use_system_certdb ()"><code class="function">g_tls_connection_set_use_system_certdb()</code></a>.
926 </p>
927 <p>Default value: TRUE</p>
928 </div>
929 </div>
930 <div class="refsect1">
931 <a name="GTlsConnection.signal-details"></a><h2>Signal Details</h2>
932 <div class="refsect2">
933 <a name="GTlsConnection-accept-certificate"></a><h3>The <code class="literal">"accept-certificate"</code> signal</h3>
934 <pre class="programlisting"><a href="./../glib/glib/glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>            user_function                      (<a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a>      *conn,
935                                                         <a class="link" href="GTlsCertificate.html" title="GTlsCertificate"><span class="type">GTlsCertificate</span></a>     *peer_cert,
936                                                         <a class="link" href="gio-TLS-Overview.html#GTlsCertificateFlags"><span class="type">GTlsCertificateFlags</span></a> errors,
937                                                         <a href="./../glib/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a>             user_data)      : <a href="./../gobject/gobject/gobject-Signals.html#G-SIGNAL-RUN-LAST:CAPS"><code class="literal">Run Last</code></a></pre>
938 <p>
939 Emitted during the TLS handshake after the peer certificate has
940 been received. You can examine <em class="parameter"><code>peer_cert</code></em>'s certification path by
941 calling <a class="link" href="GTlsCertificate.html#g-tls-certificate-get-issuer" title="g_tls_certificate_get_issuer ()"><code class="function">g_tls_certificate_get_issuer()</code></a> on it.
942 </p>
943 <p>
944 For a client-side connection, <em class="parameter"><code>peer_cert</code></em> is the server's
945 certificate, and the signal will only be emitted if the
946 certificate was not acceptable according to <em class="parameter"><code>conn</code></em>'s
947 <a class="link" href="GTlsClientConnection.html#GTlsClientConnection--validation-flags" title='The "validation-flags" property'><span class="type">"validation_flags"</span></a>. If you would like the
948 certificate to be accepted despite <em class="parameter"><code>errors</code></em>, return <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> from the
949 signal handler. Otherwise, if no handler accepts the certificate,
950 the handshake will fail with <a class="link" href="gio-TLS-Overview.html#G-TLS-ERROR-BAD-CERTIFICATE:CAPS"><code class="literal">G_TLS_ERROR_BAD_CERTIFICATE</code></a>.
951 </p>
952 <p>
953 For a server-side connection, <em class="parameter"><code>peer_cert</code></em> is the certificate
954 presented by the client, if this was requested via the server's
955 <a class="link" href="GTlsServerConnection.html#GTlsServerConnection--authentication-mode" title='The "authentication-mode" property'><span class="type">"authentication_mode"</span></a>. On the server side,
956 the signal is always emitted when the client presents a
957 certificate, and the certificate will only be accepted if a
958 handler returns <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>.
959 </p>
960 <p>
961 Note that if this signal is emitted as part of asynchronous I/O
962 in the main thread, then you should not attempt to interact with
963 the user before returning from the signal handler. If you want to
964 let the user decide whether or not to accept the certificate, you
965 would have to return <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> from the signal handler on the first
966 attempt, and then after the connection attempt returns a
967 <a class="link" href="gio-TLS-Overview.html#G-TLS-ERROR-HANDSHAKE:CAPS"><code class="literal">G_TLS_ERROR_HANDSHAKE</code></a>, you can interact with the user, and if
968 the user decides to accept the certificate, remember that fact,
969 create a new connection, and return <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> from the signal handler
970 the next time.
971 </p>
972 <p>
973 If you are doing I/O in another thread, you do not
974 need to worry about this, and can simply block in the signal
975 handler until the UI thread returns an answer.
976 </p>
977 <div class="variablelist"><table border="0">
978 <col align="left" valign="top">
979 <tbody>
980 <tr>
981 <td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
982 <td>a <a class="link" href="GTlsConnection.html" title="GTlsConnection"><span class="type">GTlsConnection</span></a>
983 </td>
984 </tr>
985 <tr>
986 <td><p><span class="term"><em class="parameter"><code>peer_cert</code></em> :</span></p></td>
987 <td>the peer's <a class="link" href="GTlsCertificate.html" title="GTlsCertificate"><span class="type">GTlsCertificate</span></a>
988 </td>
989 </tr>
990 <tr>
991 <td><p><span class="term"><em class="parameter"><code>errors</code></em> :</span></p></td>
992 <td>the problems with <em class="parameter"><code>peer_cert</code></em>.</td>
993 </tr>
994 <tr>
995 <td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
996 <td>user data set when the signal handler was connected.</td>
997 </tr>
998 <tr>
999 <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
1000 <td>
1001 <a href="./../glib/glib/glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> to accept <em class="parameter"><code>peer_cert</code></em> (which will also
1002 immediately end the signal emission). <a href="./../glib/glib/glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> to allow the signal
1003 emission to continue, which will cause the handshake to fail if
1004 no one else overrides it.</td>
1005 </tr>
1006 </tbody>
1007 </table></div>
1008 <p class="since">Since 2.28</p>
1009 </div>
1010 </div>
1011 </div>
1012 <div class="footer">
1013 <hr>
1014           Generated by GTK-Doc V1.18</div>
1015 </body>
1016 </html>