File: libsoup-soup-ssl.html

package info (click to toggle)
libsoup 2.2.98-2%2Betch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 4,180 kB
  • ctags: 3,121
  • sloc: ansic: 14,096; sh: 8,772; xml: 8,638; makefile: 192; php: 58
file content (377 lines) | stat: -rw-r--r-- 13,450 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>soup-ssl</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.71.0">
<link rel="start" href="index.html" title="libsoup Reference Manual">
<link rel="up" href="ch03.html" title="libsoup internals">
<link rel="prev" href="libsoup-soup-dns.html" title="soup-dns">
<link rel="next" href="ix01.html" title="Index">
<meta name="generator" content="GTK-Doc V1.7 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="ch01.html" title="libsoup Tutorial">
<link rel="chapter" href="ch02.html" title="libsoup API Reference">
<link rel="chapter" href="ch03.html" title="libsoup internals">
<link rel="index" href="ix01.html" title="Index">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="libsoup-soup-dns.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="ch03.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">libsoup Reference Manual</th>
<td><a accesskey="n" href="ix01.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id358252" class="shortcut">Top</a>
                  &#160;|&#160;
                  <a href="#id412980" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="libsoup-soup-ssl"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id358252"></a><span class="refentrytitle">soup-ssl</span>
</h2>
<p>soup-ssl &#8212; SSL/TLS handling</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">



extern      gboolean <a href="libsoup-soup-ssl.html#soup-ssl-supported">soup_ssl_supported</a>;

enum        <a href="libsoup-soup-ssl.html#SoupSSLType">SoupSSLType</a>;
<a
href="../glib/glib-Basic-Types.html#gpointer"
>gpointer</a>    <a href="libsoup-soup-ssl.html#soup-ssl-get-client-credentials">soup_ssl_get_client_credentials</a> (const char *ca_file);
void        <a href="libsoup-soup-ssl.html#soup-ssl-free-client-credentials">soup_ssl_free_client_credentials</a>
                                            (<a
href="../glib/glib-Basic-Types.html#gpointer"
>gpointer</a> creds);
<a
href="../glib/glib-Basic-Types.html#gpointer"
>gpointer</a>    <a href="libsoup-soup-ssl.html#soup-ssl-get-server-credentials">soup_ssl_get_server_credentials</a> (const char *cert_file,
                                             const char *key_file);
void        <a href="libsoup-soup-ssl.html#soup-ssl-free-server-credentials">soup_ssl_free_server_credentials</a>
                                            (<a
href="../glib/glib-Basic-Types.html#gpointer"
>gpointer</a> creds);
<a
href="../glib/glib-IO-Channels.html#GIOChannel"
>GIOChannel</a>* <a href="libsoup-soup-ssl.html#soup-ssl-wrap-iochannel">soup_ssl_wrap_iochannel</a>         (<a
href="../glib/glib-IO-Channels.html#GIOChannel"
>GIOChannel</a> *sock,
                                             <a href="libsoup-soup-ssl.html#SoupSSLType">SoupSSLType</a> type,
                                             const char *remote_host,
                                             <a
href="../glib/glib-Basic-Types.html#gpointer"
>gpointer</a> credentials);
#define     <a href="libsoup-soup-ssl.html#SOUP-SSL-ERROR:CAPS">SOUP_SSL_ERROR</a>
<a
href="../glib/glib-Quarks.html#GQuark"
>GQuark</a>      <a href="libsoup-soup-ssl.html#soup-ssl-error-quark">soup_ssl_error_quark</a>            (void);
enum        <a href="libsoup-soup-ssl.html#SoupSocketError">SoupSocketError</a>;
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id412980"></a><h2>Description</h2>
<p>

</p>
</div>
<div class="refsect1" lang="en">
<a name="id412997"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id413009"></a><h3>
<a name="soup-ssl-supported"></a>soup_ssl_supported</h3>
<a class="indexterm" name="id413022"></a><pre class="programlisting">extern gboolean soup_ssl_supported;
</pre>
<p>
Can be used to test if libsoup was compiled with ssl support.</p>
<p>

</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id403539"></a><h3>
<a name="SoupSSLType"></a>enum SoupSSLType</h3>
<a class="indexterm" name="id403552"></a><pre class="programlisting">typedef enum {
	SOUP_SSL_TYPE_CLIENT = 0,
	SOUP_SSL_TYPE_SERVER
} SoupSSLType;
</pre>
<p>
What kind of SSL connection this is.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><a name="SOUP-SSL-TYPE-CLIENT:CAPS"></a><code class="literal">SOUP_SSL_TYPE_CLIENT</code></span></td>
<td> the client side of an SSL connection
</td>
</tr>
<tr>
<td>
<span class="term"><a name="SOUP-SSL-TYPE-SERVER:CAPS"></a><code class="literal">SOUP_SSL_TYPE_SERVER</code></span></td>
<td> the server side of an SSL connection
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id417076"></a><h3>
<a name="soup-ssl-get-client-credentials"></a>soup_ssl_get_client_credentials ()</h3>
<a class="indexterm" name="id417090"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#gpointer"
>gpointer</a>    soup_ssl_get_client_credentials (const char *ca_file);</pre>
<p>
Creates an opaque client credentials object which can later be
passed to <a href="libsoup-soup-ssl.html#soup-ssl-wrap-iochannel"><code class="function">soup_ssl_wrap_iochannel()</code></a>.
</p>
<p>
If <em class="parameter"><code>ca_file</code></em> is non-<a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>, any certificate received from a server
must be signed by one of the CAs in the file, or an error will
be returned.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>ca_file</code></em>&#160;:</span></td>
<td> path to a file containing X509-encoded Certificate
Authority certificates.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> the client credentials, which must be freed with
<a href="libsoup-soup-ssl.html#soup-ssl-free-client-credentials"><code class="function">soup_ssl_free_client_credentials()</code></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id417196"></a><h3>
<a name="soup-ssl-free-client-credentials"></a>soup_ssl_free_client_credentials ()</h3>
<a class="indexterm" name="id417535"></a><pre class="programlisting">void        soup_ssl_free_client_credentials
                                            (<a
href="../glib/glib-Basic-Types.html#gpointer"
>gpointer</a> creds);</pre>
<p>
Frees <em class="parameter"><code>client_creds</code></em>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>creds</code></em>&#160;:</span></td>
<td> a client credentials structure returned by
<a href="libsoup-soup-ssl.html#soup-ssl-get-client-credentials"><code class="function">soup_ssl_get_client_credentials()</code></a>.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id417605"></a><h3>
<a name="soup-ssl-get-server-credentials"></a>soup_ssl_get_server_credentials ()</h3>
<a class="indexterm" name="id417619"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#gpointer"
>gpointer</a>    soup_ssl_get_server_credentials (const char *cert_file,
                                             const char *key_file);</pre>
<p>
Creates an opaque server credentials object which can later be
passed to <a href="libsoup-soup-ssl.html#soup-ssl-wrap-iochannel"><code class="function">soup_ssl_wrap_iochannel()</code></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>cert_file</code></em>&#160;:</span></td>
<td> path to a file containing an X509-encoded server
certificate
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>key_file</code></em>&#160;:</span></td>
<td> path to a file containing an X509-encoded key for
<em class="parameter"><code>cert_file</code></em>.
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> the server credentials, which must be freed with
<a href="libsoup-soup-ssl.html#soup-ssl-free-server-credentials"><code class="function">soup_ssl_free_server_credentials()</code></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id410971"></a><h3>
<a name="soup-ssl-free-server-credentials"></a>soup_ssl_free_server_credentials ()</h3>
<a class="indexterm" name="id410985"></a><pre class="programlisting">void        soup_ssl_free_server_credentials
                                            (<a
href="../glib/glib-Basic-Types.html#gpointer"
>gpointer</a> creds);</pre>
<p>
Frees <em class="parameter"><code>server_creds</code></em>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>creds</code></em>&#160;:</span></td>
<td> a server credentials structure returned by
<a href="libsoup-soup-ssl.html#soup-ssl-get-server-credentials"><code class="function">soup_ssl_get_server_credentials()</code></a>.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id411056"></a><h3>
<a name="soup-ssl-wrap-iochannel"></a>soup_ssl_wrap_iochannel ()</h3>
<a class="indexterm" name="id411069"></a><pre class="programlisting"><a
href="../glib/glib-IO-Channels.html#GIOChannel"
>GIOChannel</a>* soup_ssl_wrap_iochannel         (<a
href="../glib/glib-IO-Channels.html#GIOChannel"
>GIOChannel</a> *sock,
                                             <a href="libsoup-soup-ssl.html#SoupSSLType">SoupSSLType</a> type,
                                             const char *remote_host,
                                             <a
href="../glib/glib-Basic-Types.html#gpointer"
>gpointer</a> credentials);</pre>
<p>
This attempts to wrap a new <a
href="../glib/glib-IO-Channels.html#GIOChannel"
><span class="type">GIOChannel</span></a> around <em class="parameter"><code>sock</code></em> that
will SSL-encrypt/decrypt all traffic through it.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>sock</code></em>&#160;:</span></td>
<td> a <a
href="../glib/glib-IO-Channels.html#GIOChannel"
><span class="type">GIOChannel</span></a> wrapping a TCP socket.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>type</code></em>&#160;:</span></td>
<td> whether this is a client or server socket
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>remote_host</code></em>&#160;:</span></td>
<td> the hostname of the remote machine
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>credentials</code></em>&#160;:</span></td>
<td> a client or server credentials structure
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> an SSL-encrypting <a
href="../glib/glib-IO-Channels.html#GIOChannel"
><span class="type">GIOChannel</span></a>, or <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a> on
failure.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id416149"></a><h3>
<a name="SOUP-SSL-ERROR:CAPS"></a>SOUP_SSL_ERROR</h3>
<a class="indexterm" name="id416162"></a><pre class="programlisting">#define SOUP_SSL_ERROR soup_ssl_error_quark()
</pre>
<p>

</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id416179"></a><h3>
<a name="soup-ssl-error-quark"></a>soup_ssl_error_quark ()</h3>
<a class="indexterm" name="id416192"></a><pre class="programlisting"><a
href="../glib/glib-Quarks.html#GQuark"
>GQuark</a>      soup_ssl_error_quark            (void);</pre>
<p>
</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> The quark used as <a href="libsoup-soup-ssl.html#SOUP-SSL-ERROR:CAPS"><code class="literal">SOUP_SSL_ERROR</code></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id416245"></a><h3>
<a name="SoupSocketError"></a>enum SoupSocketError</h3>
<a class="indexterm" name="id416258"></a><pre class="programlisting">typedef enum {
	SOUP_SSL_ERROR_HANDSHAKE_NEEDS_READ,
	SOUP_SSL_ERROR_HANDSHAKE_NEEDS_WRITE,
	SOUP_SSL_ERROR_CERTIFICATE,
} SoupSocketError;
</pre>
<p>

</p>
</div>
</div>
</div>
</body>
</html>