Imported Upstream version 3.0.30
[platform/upstream/gnutls.git] / doc / gnutls-guile.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <html>
3 <!-- This manual is last updated 10 May 2012 for version
4 3.0.30 of GnuTLS.
5
6 Copyright (C) 2001-2012 Free Software Foundation, Inc.
7
8 Permission is granted to copy, distribute and/or modify this document
9 under the terms of the GNU Free Documentation License, Version 1.3 or
10 any later version published by the Free Software Foundation; with no
11 Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.  A
12 copy of the license is included in the section entitled "GNU Free
13 Documentation License". -->
14 <!-- Created by GNU Texinfo 4.13.90, http://www.gnu.org/software/texinfo/ -->
15 <head>
16 <title>GnuTLS-Guile 3.0.30</title>
17
18 <meta name="description" content="GnuTLS-Guile 3.0.30">
19 <meta name="keywords" content="GnuTLS-Guile 3.0.30">
20 <meta name="resource-type" content="document">
21 <meta name="distribution" content="global">
22 <meta name="Generator" content="makeinfo">
23 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
24 <link href="#Top" rel="start" title="Top">
25 <link href="#SEC_Contents" rel="contents" title="Table of Contents">
26 <link href="dir.html#Top" rel="up" title="(dir)">
27 <style type="text/css">
28 <!--
29 a.summary-letter {text-decoration: none}
30 blockquote.smallquotation {font-size: smaller}
31 div.display {margin-left: 3.2em}
32 div.example {margin-left: 3.2em}
33 div.indentedblock {margin-left: 3.2em}
34 div.lisp {margin-left: 3.2em}
35 div.smalldisplay {margin-left: 3.2em}
36 div.smallexample {margin-left: 3.2em}
37 div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
38 div.smalllisp {margin-left: 3.2em}
39 kbd {font-style:oblique}
40 pre.display {font-family: inherit}
41 pre.format {font-family: inherit}
42 pre.menu-comment {font-family: serif}
43 pre.menu-preformatted {font-family: serif}
44 pre.smalldisplay {font-family: inherit; font-size: smaller}
45 pre.smallexample {font-size: smaller}
46 pre.smallformat {font-family: inherit; font-size: smaller}
47 pre.smalllisp {font-size: smaller}
48 span.nocodebreak {white-space:nowrap}
49 span.nolinebreak {white-space:nowrap}
50 span.roman {font-family:serif; font-weight:normal}
51 span.sansserif {font-family:sans-serif; font-weight:normal}
52 ul.no-bullet {list-style: none}
53 body { 
54         margin: 2%;
55         padding: 0 5%;
56         background: #ffffff;
57 }
58 h1,h2,h3,h4,h5 {
59     font-weight: bold;
60     padding: 5px 5px 5px 5px;
61     background-color: #c2e0ff;
62     color: #336699;
63 }
64 h1 {
65     padding: 2em 2em 2em 5%;
66     color: white;
67     background: #336699;
68     text-align: center;
69     letter-spacing: 3px;
70 }
71 h2 { text-decoration: underline; }
72 pre {
73   margin: 0 5%;
74   padding: 0.5em;
75 }
76 pre.example,pre.verbatim {
77   padding-bottom: 1em;
78
79   border: solid #c2e0ff;
80   background: #f0faff;
81   border-width: 1px 1px 1px 5px;
82   margin: 1em auto;
83   width: 90%;
84 }
85
86 div.node {
87   margin: 0 -5% 0 -2%;
88   padding: 0.5em 0.5em;
89   margin-top: 0.5em;
90   margin-bottom: 0.5em;
91   font-weight: bold;
92 }
93 dd, li {
94   padding-top: 0.1em;
95   padding-bottom: 0.1em;
96 }
97 div.float {
98
99   margin-bottom: 0.5em;
100   text-align: center;
101 }
102
103 table {
104   text-align: left;
105   margin-left:auto;
106   margin-right:auto;
107   width: 50%;
108 }
109
110 th {
111   padding: 0;
112   color: #336699;
113   background-color: #c2e0ff;
114   border: solid #000000;
115   border-width: 0px;
116   margin: 1em auto;
117   text-align: center;
118   margin-left:auto;
119   margin-right:auto;
120 }
121
122 td {
123   padding: 0;
124   border: solid #000000;
125   background-color: #f0faff;
126   border-width: 0px;
127   margin: 1em auto;
128   text-align: left;
129   margin-left:auto;
130   margin-right:auto;
131   padding-left: 1em;
132 }
133
134 dl {
135   text-align: left;
136   margin-left:auto;
137   margin-right:auto;
138   width: 50%;
139
140   padding-left: 1em;
141   border: solid #c2e0ff;
142   background: #f0faff;
143   border-width: 5px 1px 1px 1px;
144   margin: 1em auto;
145 }
146
147 -->
148 </style>
149
150
151 </head>
152
153 <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
154 <h1 class="settitle" align="center">GnuTLS-Guile 3.0.30</h1>
155
156
157
158
159
160
161
162 <a name="SEC_Contents"></a>
163 <h2 class="contents-heading">Table of Contents</h2>
164
165 <div class="contents">
166
167 <ul class="no-bullet">
168   <li><a name="toc-Preface-1" href="#Preface">1 Preface</a></li>
169   <li><a name="toc-Guile-Preparations-1" href="#Guile-Preparations">2 Guile Preparations</a></li>
170   <li><a name="toc-Guile-API-Conventions-1" href="#Guile-API-Conventions">3 Guile API Conventions</a>
171   <ul class="no-bullet">
172     <li><a name="toc-Enumerates-and-Constants-1" href="#Enumerates-and-Constants">3.1 Enumerates and Constants</a></li>
173     <li><a name="toc-Procedure-Names-1" href="#Procedure-Names">3.2 Procedure Names</a></li>
174     <li><a name="toc-Representation-of-Binary-Data-1" href="#Representation-of-Binary-Data">3.3 Representation of Binary Data</a></li>
175     <li><a name="toc-Input-and-Output-1" href="#Input-and-Output">3.4 Input and Output</a></li>
176     <li><a name="toc-Exception-Handling-1" href="#Exception-Handling">3.5 Exception Handling</a></li>
177   </ul></li>
178   <li><a name="toc-Guile-Examples-1" href="#Guile-Examples">4 Guile Examples</a>
179   <ul class="no-bullet">
180     <li><a name="toc-Anonymous-Authentication-Guile-Example-1" href="#Anonymous-Authentication-Guile-Example">4.1 Anonymous Authentication Guile Example</a></li>
181     <li><a name="toc-OpenPGP-Authentication-Guile-Example-1" href="#OpenPGP-Authentication-Guile-Example">4.2 OpenPGP Authentication Guile Example</a></li>
182     <li><a name="toc-Importing-OpenPGP-Keys-Guile-Example-1" href="#Importing-OpenPGP-Keys-Guile-Example">4.3 Importing OpenPGP Keys Guile Example</a></li>
183   </ul></li>
184   <li><a name="toc-Guile-Reference-1" href="#Guile-Reference">5 Guile Reference</a></li>
185   <li><a name="toc-Copying-Information-1" href="#Copying-Information">Appendix A Copying Information</a></li>
186 </ul>
187 </div>
188
189
190 <a name="Top"></a>
191 <div class="header">
192 <p>
193 Next: <a href="#Preface" accesskey="n" rel="next">Preface</a>, Up: <a href="dir.html#Top" accesskey="u" rel="up">(dir)</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
194 </div>
195 <a name="GnuTLS_002dGuile"></a>
196 <h1 class="top">GnuTLS-Guile</h1>
197
198 <p>This manual is last updated 10 May 2012 for version
199 3.0.30 of GnuTLS.
200 </p>
201 <p>Copyright &copy; 2001-2012 Free Software Foundation, Inc.
202 </p>
203 <blockquote>
204 <p>Permission is granted to copy, distribute and/or modify this document
205 under the terms of the GNU Free Documentation License, Version 1.3 or
206 any later version published by the Free Software Foundation; with no
207 Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.  A
208 copy of the license is included in the section entitled &ldquo;GNU Free
209 Documentation License&rdquo;.
210 </p></blockquote>
211
212
213 <table class="menu" border="0" cellspacing="0">
214 <tr><td align="left" valign="top">&bull; <a href="#Preface" accesskey="1">Preface</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Preface.
215 </td></tr>
216 <tr><td align="left" valign="top">&bull; <a href="#Guile-Preparations" accesskey="2">Guile Preparations</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Note on installation and environment.
217 </td></tr>
218 <tr><td align="left" valign="top">&bull; <a href="#Guile-API-Conventions" accesskey="3">Guile API Conventions</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Naming conventions and other idiosyncrasies.
219 </td></tr>
220 <tr><td align="left" valign="top">&bull; <a href="#Guile-Examples" accesskey="4">Guile Examples</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Quick start.
221 </td></tr>
222 <tr><td align="left" valign="top">&bull; <a href="#Guile-Reference" accesskey="5">Guile Reference</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">The Scheme GnuTLS programming interface.
223 </td></tr>
224 <tr><td align="left" valign="top">&bull; <a href="#Copying-Information" accesskey="6">Copying Information</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Copying information.
225 </td></tr>
226 </table>
227
228 <hr>
229 <a name="Preface"></a>
230 <div class="header">
231 <p>
232 Next: <a href="#Guile-Preparations" accesskey="n" rel="next">Guile Preparations</a>, Previous: <a href="#Top" accesskey="p" rel="previous">Top</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
233 </div>
234 <a name="Preface-1"></a>
235 <h2 class="chapter">1 Preface</h2>
236
237 <p>This manual describes the <a href="http://www.gnu.org/software/guile/">GNU Guile</a> Scheme programming interface to GnuTLS.  The reader is
238 assumed to have basic knowledge of the protocol and library.  Details
239 missing from this chapter may be found in Function reference,
240 of the C API reference.
241 </p>
242 <p>At this stage, not all the C functions are available from Scheme, but
243 a large subset thereof is available.
244 </p>
245 <hr>
246 <a name="Guile-Preparations"></a>
247 <div class="header">
248 <p>
249 Next: <a href="#Guile-API-Conventions" accesskey="n" rel="next">Guile API Conventions</a>, Previous: <a href="#Preface" accesskey="p" rel="previous">Preface</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
250 </div>
251 <a name="Guile-Preparations-1"></a>
252 <h2 class="chapter">2 Guile Preparations</h2>
253
254 <p>The GnuTLS Guile bindings are available for both the 1.8 and 2.0 stable
255 series of Guile.
256 </p>
257 <p>By default they are installed under the GnuTLS installation directory,
258 typically <samp>/usr/local/share/guile/site/</samp>).  Normally Guile
259 will not find the module there without help.  You may experience
260 something like this:
261 </p>
262 <div class="example">
263 <pre class="example">$ guile
264 guile&gt; (use-modules (gnutls))
265 &lt;unnamed port&gt;: no code for module (gnutls)
266 guile&gt;
267 </pre></div>
268
269 <p>There are two ways to solve this.  The first is to make sure that when
270 building GnuTLS, the Guile bindings will be installed in the same
271 place where Guile looks.  You may do this by using the
272 <code>--with-guile-site-dir</code> parameter as follows:
273 </p>
274 <div class="example">
275 <pre class="example">$ ./configure --with-guile-site-dir=no
276 </pre></div>
277
278 <p>This will instruct GnuTLS to attempt to install the Guile bindings
279 where Guile will look for them.  It will use <code>guile-config info
280 pkgdatadir</code> to learn the path to use.
281 </p>
282 <p>If Guile was installed into <code>/usr</code>, you may also install GnuTLS
283 using the same prefix:
284 </p>
285 <div class="example">
286 <pre class="example">$ ./configure --prefix=/usr
287 </pre></div>
288
289 <p>If you want to specify the path to install the Guile bindings you can
290 also specify the path directly:
291 </p>
292 <div class="example">
293 <pre class="example">$ ./configure --with-guile-site-dir=/opt/guile/share/guile/site
294 </pre></div>
295
296 <p>The second solution requires some more work but may be easier to use
297 if you do not have system administrator rights to your machine.  You
298 need to instruct Guile so that it finds the GnuTLS Guile bindings.
299 Either use the <code>GUILE_LOAD_PATH</code> environment variable as follows:
300 </p>
301 <div class="example">
302 <pre class="example">$ GUILE_LOAD_PATH=&quot;/usr/local/share/guile/site:$GUILE_LOAD_PATH&quot; guile
303 guile&gt; (use-modules (gnutls))
304 guile&gt;
305 </pre></div>
306
307 <p>Alternatively, you can modify Guile&rsquo;s <code>%load-path</code> variable
308 (see <a href="http://www.gnu.org/software/guile/manual/guile.html#Build-Config">Guile&rsquo;s run-time options</a> in <cite>The GNU Guile
309 Reference Manual</cite>).
310 </p>
311 <p>At this point, you might get an error regarding
312 <samp>libguile-gnutls-v-0</samp> similar to:
313 </p>
314 <div class="example">
315 <pre class="example">gnutls.scm:361:1: In procedure dynamic-link in expression (load-extension &quot;libguile-gnutls-v-0&quot; &quot;scm_init_gnutls&quot;):
316 gnutls.scm:361:1: file: &quot;libguile-gnutls-v-0&quot;, message: &quot;libguile-gnutls-v-0.so: cannot open shared object file: No such file or directory&quot;
317 </pre></div>
318
319 <p>In this case, you will need to modify the run-time linker path, for
320 example as follows:
321 </p>
322 <div class="example">
323 <pre class="example">$ LD_LIBRARY_PATH=/usr/local/lib GUILE_LOAD_PATH=/usr/local/share/guile/site guile
324 guile&gt; (use-modules (gnutls))
325 guile&gt;
326 </pre></div>
327
328 <p>To check that you got the intended GnuTLS library version, you may
329 print the version number of the loaded library as follows:
330 </p>
331 <div class="example">
332 <pre class="example">$ guile
333 guile&gt; (use-modules (gnutls))
334 guile&gt; (gnutls-version)
335 &quot;3.0.30&quot;
336 guile&gt; 
337 </pre></div>
338
339
340 <hr>
341 <a name="Guile-API-Conventions"></a>
342 <div class="header">
343 <p>
344 Next: <a href="#Guile-Examples" accesskey="n" rel="next">Guile Examples</a>, Previous: <a href="#Guile-Preparations" accesskey="p" rel="previous">Guile Preparations</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
345 </div>
346 <a name="Guile-API-Conventions-1"></a>
347 <h2 class="chapter">3 Guile API Conventions</h2>
348
349 <p>This chapter details the conventions used by Guile API, as well as
350 specificities of the mapping of the C API to Scheme.
351 </p>
352 <table class="menu" border="0" cellspacing="0">
353 <tr><td align="left" valign="top">&bull; <a href="#Enumerates-and-Constants" accesskey="1">Enumerates and Constants</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Representation of C-side constants.
354 </td></tr>
355 <tr><td align="left" valign="top">&bull; <a href="#Procedure-Names" accesskey="2">Procedure Names</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Naming conventions.
356 </td></tr>
357 <tr><td align="left" valign="top">&bull; <a href="#Representation-of-Binary-Data" accesskey="3">Representation of Binary Data</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Binary data buffers.
358 </td></tr>
359 <tr><td align="left" valign="top">&bull; <a href="#Input-and-Output" accesskey="4">Input and Output</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Input and output.
360 </td></tr>
361 <tr><td align="left" valign="top">&bull; <a href="#Exception-Handling" accesskey="5">Exception Handling</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Exceptions.
362 </td></tr>
363 </table>
364
365 <hr>
366 <a name="Enumerates-and-Constants"></a>
367 <div class="header">
368 <p>
369 Next: <a href="#Procedure-Names" accesskey="n" rel="next">Procedure Names</a>, Up: <a href="#Guile-API-Conventions" accesskey="u" rel="up">Guile API Conventions</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
370 </div>
371 <a name="Enumerates-and-Constants-1"></a>
372 <h3 class="section">3.1 Enumerates and Constants</h3>
373
374 <a name="index-enumerate"></a>
375 <a name="index-constant"></a>
376
377 <p>Lots of enumerates and constants are used in the GnuTLS C API.  For
378 each C enumerate type, a disjoint Scheme type is used&mdash;thus,
379 enumerate values and constants are not represented by Scheme symbols
380 nor by integers.  This makes it impossible to use an enumerate value
381 of the wrong type on the Scheme side: such errors are automatically
382 detected by type-checking.
383 </p>
384 <p>The enumerate values are bound to variables exported by the
385 <code>(gnutls)</code> module.  These variables
386 are named according to the following convention:
387 </p>
388 <ul>
389 <li> All variable names are lower-case; the underscore <code>_</code>
390 character used in the C API is replaced by hyphen <code>-</code>.
391 </li><li> All variable names are prepended by the name of the enumerate
392 type and the slash <code>/</code> character.
393 </li><li> In some cases, the variable name is made more explicit than the
394 one of the C API, e.g., by avoid abbreviations.
395 </li></ul>
396
397 <p>Consider for instance this C-side enumerate:
398 </p>
399 <div class="example">
400 <pre class="example">typedef enum
401 {
402   GNUTLS_CRD_CERTIFICATE = 1,
403   GNUTLS_CRD_ANON,
404   GNUTLS_CRD_SRP,
405   GNUTLS_CRD_PSK
406 } gnutls_credentials_type_t;
407 </pre></div>
408
409 <p>The corresponding Scheme values are bound to the following variables
410 exported by the <code>(gnutls)</code> module:
411 </p>
412 <div class="example">
413 <pre class="example">credentials/certificate
414 credentials/anonymous
415 credentials/srp
416 credentials/psk
417 </pre></div>
418
419 <p>Hopefully, most variable names can be deduced from this convention.
420 </p>
421 <p>Scheme-side &ldquo;enumerate&rdquo; values can be compared using <code>eq?</code>
422 (see <a href="http://www.gnu.org/software/guile/manual/guile.html#Equality">equality predicates</a> in <cite>The GNU Guile Reference
423 Manual</cite>).  Consider the following example:
424 </p>
425 <a name="index-session_002dcipher"></a>
426
427 <div class="example">
428 <pre class="example">(let ((session (make-session connection-end/client)))
429
430   ;;
431   ;; ...
432   ;;
433
434   ;; Check the ciphering algorithm currently used by SESSION.
435   (if (eq? cipher/arcfour (session-cipher session))
436       (format #t &quot;We're using the ARCFOUR algorithm&quot;)))
437 </pre></div>
438
439 <p>In addition, all enumerate values can be converted to a human-readable
440 string, in a type-specific way.  For instance, <code>(cipher-&gt;string
441 cipher/arcfour)</code> yields <code>&quot;ARCFOUR 128&quot;</code>, while
442 <code>(key-usage-&gt;string key-usage/digital-signature)</code> yields
443 <code>&quot;digital-signature&quot;</code>.  Note that these strings may not be
444 sufficient for use in a user interface since they are fairly concise
445 and not internationalized.
446 </p>
447
448 <hr>
449 <a name="Procedure-Names"></a>
450 <div class="header">
451 <p>
452 Next: <a href="#Representation-of-Binary-Data" accesskey="n" rel="next">Representation of Binary Data</a>, Previous: <a href="#Enumerates-and-Constants" accesskey="p" rel="previous">Enumerates and Constants</a>, Up: <a href="#Guile-API-Conventions" accesskey="u" rel="up">Guile API Conventions</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
453 </div>
454 <a name="Procedure-Names-1"></a>
455 <h3 class="section">3.2 Procedure Names</h3>
456
457 <p>Unlike C functions in GnuTLS, the corresponding Scheme procedures are
458 named in a way that is close to natural English.  Abbreviations are
459 also avoided.  For instance, the Scheme procedure corresponding to
460 <code>gnutls_certificate_set_dh_params</code> is named
461 <code>set-certificate-credentials-dh-parameters!</code>.  The <code>gnutls_</code>
462 prefix is always omitted from variable names since a similar effect
463 can be achieved using Guile&rsquo;s nifty binding renaming facilities,
464 should it be needed (see <a href="http://www.gnu.org/software/guile/manual/guile.html#Using-Guile-Modules">Using Guile Modules</a> in <cite>The GNU
465 Guile Reference Manual</cite>).
466 </p>
467 <p>Often Scheme procedure names differ from C function names in a way
468 that makes it clearer what objects they operate on.  For example, the
469 Scheme procedure named <code>set-session-transport-port!</code> corresponds
470 to <code>gnutls_transport_set_ptr</code>, making it clear that this
471 procedure applies to session.
472 </p>
473 <hr>
474 <a name="Representation-of-Binary-Data"></a>
475 <div class="header">
476 <p>
477 Next: <a href="#Input-and-Output" accesskey="n" rel="next">Input and Output</a>, Previous: <a href="#Procedure-Names" accesskey="p" rel="previous">Procedure Names</a>, Up: <a href="#Guile-API-Conventions" accesskey="u" rel="up">Guile API Conventions</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
478 </div>
479 <a name="Representation-of-Binary-Data-1"></a>
480 <h3 class="section">3.3 Representation of Binary Data</h3>
481
482 <p>Many procedures operate on binary data.  For instance,
483 <code>pkcs3-import-dh-parameters</code> expects binary data as input and,
484 similarly, procedures like <code>pkcs1-export-rsa-parameters</code> return
485 binary data.
486 </p>
487 <a name="index-SRFI_002d4"></a>
488 <a name="index-homogeneous-vector"></a>
489
490 <p>Binary data is represented on the Scheme side using SRFI-4 homogeneous
491 vectors (see <a href="http://www.gnu.org/software/guile/manual/guile.html#SRFI_002d4">SRFI-4</a> in <cite>The GNU Guile Reference Manual</cite>).
492 Although any type of homogeneous vector may be used, <code>u8vector</code>s
493 (i.e., vectors of bytes) are highly recommended.
494 </p>
495 <p>As an example, generating and then exporting RSA parameters in the PEM
496 format can be done as follows:
497 </p>
498 <a name="index-make_002drsa_002dparameters"></a>
499 <a name="index-pkcs1_002dexport_002drsa_002dparameters"></a>
500 <a name="index-x509_002dcertificate_002dformat_002fpem"></a>
501
502 <div class="example">
503 <pre class="example">(let* ((rsa-params (make-rsa-parameters 1024))
504        (raw-data
505         (pkcs1-export-rsa-parameters rsa-params
506                                      x509-certificate-format/pem)))
507   (uniform-vector-write raw-data (open-output-file &quot;some-file.pem&quot;)))
508 </pre></div>
509
510 <p>For an example of OpenPGP key import from a file, see <a href="#Importing-OpenPGP-Keys-Guile-Example">Importing OpenPGP Keys Guile Example</a>.
511 </p>
512
513 <hr>
514 <a name="Input-and-Output"></a>
515 <div class="header">
516 <p>
517 Next: <a href="#Exception-Handling" accesskey="n" rel="next">Exception Handling</a>, Previous: <a href="#Representation-of-Binary-Data" accesskey="p" rel="previous">Representation of Binary Data</a>, Up: <a href="#Guile-API-Conventions" accesskey="u" rel="up">Guile API Conventions</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
518 </div>
519 <a name="Input-and-Output-1"></a>
520 <h3 class="section">3.4 Input and Output</h3>
521
522 <a name="index-set_002dsession_002dtransport_002dport_0021"></a>
523 <a name="index-set_002dsession_002dtransport_002dfd_0021"></a>
524
525 <p>The underlying transport of a TLS session can be any Scheme
526 input/output port (see <a href="http://www.gnu.org/software/guile/manual/guile.html#Ports-and-File-Descriptors">Ports and File Descriptors</a> in <cite>The GNU
527 Guile Reference Manual</cite>).  This has to be specified using
528 <code>set-session-transport-port!</code>.
529 </p>
530 <p>However, for better performance, a raw file descriptor can be
531 specified, using <code>set-session-transport-fd!</code>.  For instance, if
532 the transport layer is a socket port over an OS-provided socket, you
533 can use the <code>port-&gt;fdes</code> or <code>fileno</code> procedure to obtain the
534 underlying file descriptor and pass it to
535 <code>set-session-transport-fd!</code>  (see <a href="http://www.gnu.org/software/guile/manual/guile.html#Ports-and-File-Descriptors"><code>port-&gt;fdes</code> and <code>fileno</code></a> in <cite>The GNU Guile Reference
536 Manual</cite>).  This would work as follows:
537 </p>
538 <div class="example">
539 <pre class="example">(let ((socket (socket PF_INET SOCK_STREAM 0))
540       (session (make-session connection-end/client)))
541
542   ;;
543   ;; Establish a TCP connection...
544   ;;
545
546   ;; Use the file descriptor that underlies SOCKET.
547   (set-session-transport-fd! session (fileno socket)))
548 </pre></div>
549
550 <a name="index-session_002drecord_002dport"></a>
551
552 <p>Once a TLS session is established, data can be communicated through it
553 (i.e., <em>via</em> the TLS record layer) using the port returned by
554 <code>session-record-port</code>:
555 </p>
556 <div class="example">
557 <pre class="example">(let ((session (make-session connection-end/client)))
558
559   ;;
560   ;; Initialize the various parameters of SESSION, set up
561   ;; a network connection, etc...
562   ;;
563
564   (let ((i/o (session-record-port session)))
565     (write &quot;Hello peer!&quot; i/o)
566     (let ((greetings (read i/o)))
567
568       ;; ...
569
570       (bye session close-request/rdwr))))
571 </pre></div>
572
573 <a name="index-record_002dsend"></a>
574 <a name="index-record_002dreceive_0021"></a>
575
576 <p>A lower-level I/O API is provided by <code>record-send</code> and
577 <code>record-receive!</code> which take an SRFI-4 vector to represent the
578 data sent or received.  While it might improve performance, it is much
579 less convenient than the above and should rarely be needed.
580 </p>
581
582 <hr>
583 <a name="Exception-Handling"></a>
584 <div class="header">
585 <p>
586 Previous: <a href="#Input-and-Output" accesskey="p" rel="previous">Input and Output</a>, Up: <a href="#Guile-API-Conventions" accesskey="u" rel="up">Guile API Conventions</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
587 </div>
588 <a name="Exception-Handling-1"></a>
589 <h3 class="section">3.5 Exception Handling</h3>
590
591 <a name="index-exceptions"></a>
592 <a name="index-errors"></a>
593 <a name="index-gnutls_002derror"></a>
594 <a name="index-error_002d_003estring"></a>
595
596 <p>GnuTLS errors are implemented as Scheme exceptions (see <a href="http://www.gnu.org/software/guile/manual/guile.html#Exceptions">exceptions in Guile</a> in <cite>The GNU Guile Reference Manual</cite>).  Each
597 time a GnuTLS function returns an error, an exception with key
598 <code>gnutls-error</code> is raised.  The additional arguments that are
599 thrown include an error code and the name of the GnuTLS procedure that
600 raised the exception.  The error code is pretty much like an enumerate
601 value: it is one of the <code>error/</code> variables exported by the
602 <code>(gnutls)</code> module (see <a href="#Enumerates-and-Constants">Enumerates and Constants</a>).  Exceptions
603 can be turned into error messages using the <code>error-&gt;string</code>
604 procedure.
605 </p>
606 <p>The following examples illustrates how GnuTLS exceptions can be
607 handled:
608 </p>
609 <div class="example">
610 <pre class="example">(let ((session (make-session connection-end/server)))
611
612   ;;
613   ;; ...
614   ;;
615
616   (catch 'gnutls-error
617     (lambda ()
618       (handshake session))
619     (lambda (key err function . currently-unused)
620       (format (current-error-port)
621               &quot;a GnuTLS error was raised by `~a': ~a~%&quot;
622               function (error-&gt;string err)))))
623 </pre></div>
624
625 <p>Again, error values can be compared using <code>eq?</code>:
626 </p>
627 <div class="example">
628 <pre class="example">    ;; `gnutls-error' handler.
629     (lambda (key err function . currently-unused)
630       (if (eq? err error/fatal-alert-received)
631           (format (current-error-port)
632                   &quot;a fatal alert was caught!~%&quot;)
633           (format (current-error-port)
634                   &quot;something bad happened: ~a~%&quot;
635                   (error-&gt;string err))))
636 </pre></div>
637
638 <p>Note that the <code>catch</code> handler is currently passed only 3
639 arguments but future versions might provide it with additional
640 arguments.  Thus, it must be prepared to handle more than 3 arguments,
641 as in this example.
642 </p>
643
644 <hr>
645 <a name="Guile-Examples"></a>
646 <div class="header">
647 <p>
648 Next: <a href="#Guile-Reference" accesskey="n" rel="next">Guile Reference</a>, Previous: <a href="#Guile-API-Conventions" accesskey="p" rel="previous">Guile API Conventions</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
649 </div>
650 <a name="Guile-Examples-1"></a>
651 <h2 class="chapter">4 Guile Examples</h2>
652
653 <p>This chapter provides examples that illustrate common use cases.
654 </p>
655 <table class="menu" border="0" cellspacing="0">
656 <tr><td align="left" valign="top">&bull; <a href="#Anonymous-Authentication-Guile-Example" accesskey="1">Anonymous Authentication Guile Example</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Simplest client and server.
657 </td></tr>
658 <tr><td align="left" valign="top">&bull; <a href="#OpenPGP-Authentication-Guile-Example" accesskey="2">OpenPGP Authentication Guile Example</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Using OpenPGP-based authentication.
659 </td></tr>
660 <tr><td align="left" valign="top">&bull; <a href="#Importing-OpenPGP-Keys-Guile-Example" accesskey="3">Importing OpenPGP Keys Guile Example</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Importing keys from files.
661 </td></tr>
662 </table>
663
664 <hr>
665 <a name="Anonymous-Authentication-Guile-Example"></a>
666 <div class="header">
667 <p>
668 Next: <a href="#OpenPGP-Authentication-Guile-Example" accesskey="n" rel="next">OpenPGP Authentication Guile Example</a>, Up: <a href="#Guile-Examples" accesskey="u" rel="up">Guile Examples</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
669 </div>
670 <a name="Anonymous-Authentication-Guile-Example-1"></a>
671 <h3 class="section">4.1 Anonymous Authentication Guile Example</h3>
672
673 <p><em>Anonymous authentication</em> is very easy to use.  No certificates
674 are needed by the communicating parties.  Yet, it allows them to
675 benefit from end-to-end encryption and integrity checks.
676 </p>
677 <p>The client-side code would look like this (assuming <var>some-socket</var>
678 is bound to an open socket port):
679 </p>
680 <a name="index-connection_002dend_002fclient"></a>
681 <a name="index-kx_002fanon_002ddh"></a>
682 <a name="index-close_002drequest_002frdwr"></a>
683
684 <div class="example">
685 <pre class="example">;; Client-side.
686
687 (let ((client (make-session connection-end/client)))
688   ;; Use the default settings.
689   (set-session-default-priority! client)
690
691   ;; Don't use certificate-based authentication.
692   (set-session-certificate-type-priority! client '())
693
694   ;; Request the &quot;anonymous Diffie-Hellman&quot; key exchange method.
695   (set-session-kx-priority! client (list kx/anon-dh))
696
697   ;; Specify the underlying socket.
698   (set-session-transport-fd! client (fileno some-socket))
699
700   ;; Create anonymous credentials.
701   (set-session-credentials! client
702                             (make-anonymous-client-credentials))
703
704   ;; Perform the TLS handshake with the server.
705   (handshake client)
706
707   ;; Send data over the TLS record layer.
708   (write &quot;hello, world!&quot; (session-record-port client))
709
710   ;; Terminate the TLS session.
711   (bye client close-request/rdwr))
712 </pre></div>
713
714 <p>The corresponding server would look like this (again, assuming
715 <var>some-socket</var> is bound to a socket port):
716 </p>
717 <a name="index-connection_002dend_002fserver"></a>
718
719 <div class="example">
720 <pre class="example">;; Server-side.
721
722 (let ((server (make-session connection-end/server)))
723   (set-session-default-priority! server)
724   (set-session-certificate-type-priority! server '())
725   (set-session-kx-priority! server (list kx/anon-dh))
726
727   ;; Specify the underlying transport socket.
728   (set-session-transport-fd! server (fileno some-socket))
729
730   ;; Create anonymous credentials.
731   (let ((cred (make-anonymous-server-credentials))
732         (dh-params (make-dh-parameters 1024)))
733     ;; Note: DH parameter generation can take some time.
734     (set-anonymous-server-dh-parameters! cred dh-params)
735     (set-session-credentials! server cred))
736
737   ;; Perform the TLS handshake with the client.
738   (handshake server)
739
740   ;; Receive data over the TLS record layer.
741   (let ((message (read (session-record-port server))))
742     (format #t &quot;received the following message: ~a~%&quot;
743             message)
744
745     (bye server close-request/rdwr)))
746 </pre></div>
747
748 <p>This is it!
749 </p>
750
751 <hr>
752 <a name="OpenPGP-Authentication-Guile-Example"></a>
753 <div class="header">
754 <p>
755 Next: <a href="#Importing-OpenPGP-Keys-Guile-Example" accesskey="n" rel="next">Importing OpenPGP Keys Guile Example</a>, Previous: <a href="#Anonymous-Authentication-Guile-Example" accesskey="p" rel="previous">Anonymous Authentication Guile Example</a>, Up: <a href="#Guile-Examples" accesskey="u" rel="up">Guile Examples</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
756 </div>
757 <a name="OpenPGP-Authentication-Guile-Example-1"></a>
758 <h3 class="section">4.2 OpenPGP Authentication Guile Example</h3>
759
760 <p>GnuTLS allows users to authenticate using OpenPGP certificates.
761 Using OpenPGP-based authentication is not more complicated than using
762 anonymous authentication.  It requires a bit of extra work, though, to
763 import the OpenPGP public and private key of the client/server.  Key
764 import is omitted here and is left as an exercise to the reader
765 (see <a href="#Importing-OpenPGP-Keys-Guile-Example">Importing OpenPGP Keys Guile Example</a>).
766 </p>
767 <p>Assuming <var>some-socket</var> is bound to an open socket port and
768 <var>pub</var> and <var>sec</var> are bound to the client&rsquo;s OpenPGP public and
769 secret key, respectively, client-side code would look like this:
770 </p>
771 <a name="index-certificate_002dtype_002fopenpgp"></a>
772
773 <div class="example">
774 <pre class="example">;; Client-side.
775
776 (define %certs (list certificate-type/openpgp))
777
778 (let ((client (make-session connection-end/client))
779       (cred   (make-certificate-credentials)))
780   (set-session-default-priority! client)
781
782   ;; Choose OpenPGP certificates.
783   (set-session-certificate-type-priority! client %certs)
784
785   ;; Prepare appropriate client credentials.
786   (set-certificate-credentials-openpgp-keys! cred pub sec)
787   (set-session-credentials! client cred)
788
789   ;; Specify the underlying transport socket.
790   (set-session-transport-fd! client (fileno some-socket))
791
792   (handshake client)
793   (write &quot;hello, world!&quot; (session-record-port client))
794   (bye client close-request/rdwr))
795 </pre></div>
796
797 <p>Similarly, server-side code would be along these lines:
798 </p>
799 <div class="example">
800 <pre class="example">;; Server-side.
801
802 (define %certs (list certificate-type/openpgp))
803
804 (let ((server (make-session connection-end/server))
805       (rsa    (make-rsa-parameters 1024))
806       (dh     (make-dh-parameters 1024)))
807   (set-session-default-priority! server)
808
809   ;; Choose OpenPGP certificates.
810   (set-session-certificate-type-priority! server %certs)
811
812   (let ((cred (make-certificate-credentials)))
813     ;; Prepare credentials with RSA and Diffie-Hellman parameters.
814     (set-certificate-credentials-dh-parameters! cred dh)
815     (set-certificate-credentials-rsa-export-parameters! cred rsa)
816     (set-certificate-credentials-openpgp-keys! cred pub sec)
817     (set-session-credentials! server cred))
818
819   (set-session-transport-fd! server (fileno some-socket))
820
821   (handshake server)
822   (let ((msg (read (session-record-port server))))
823     (format #t &quot;received: ~a~%&quot; msg)
824
825     (bye server close-request/rdwr)))
826 </pre></div>
827
828 <p>In practice, generating RSA parameters (and Diffie-Hellman parameters)
829 can time a long time.  Thus, you may want to generate them once and
830 store them in a file for future re-use (see <a href="#Guile-Reference"><code>pkcs1-export-rsa-parameters</code> and <code>pkcs1-import-rsa-parameters</code></a>).
831 </p>
832 <hr>
833 <a name="Importing-OpenPGP-Keys-Guile-Example"></a>
834 <div class="header">
835 <p>
836 Previous: <a href="#OpenPGP-Authentication-Guile-Example" accesskey="p" rel="previous">OpenPGP Authentication Guile Example</a>, Up: <a href="#Guile-Examples" accesskey="u" rel="up">Guile Examples</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
837 </div>
838 <a name="Importing-OpenPGP-Keys-Guile-Example-1"></a>
839 <h3 class="section">4.3 Importing OpenPGP Keys Guile Example</h3>
840
841 <p>The following example provides a simple way of importing
842 &ldquo;ASCII-armored&rdquo; OpenPGP keys from files, using the
843 <code>import-openpgp-certificate</code> and <code>import-openpgp-private-key</code>
844 procedures.
845 </p>
846 <a name="index-openpgp_002dcertificate_002dformat_002fbase64"></a>
847 <a name="index-openpgp_002dcertificate_002dformat_002fraw"></a>
848
849 <div class="example">
850 <pre class="example">(use-modules (srfi srfi-4)
851              (gnutls))
852
853 (define (import-key-from-file import-proc file)
854   ;; Import OpenPGP key from FILE using IMPORT-PROC.
855
856   ;; Prepare a u8vector large enough to hold the raw
857   ;; key contents.
858   (let* ((size (stat:size (stat path)))
859          (raw  (make-u8vector size)))
860
861     ;; Fill in the u8vector with the contents of FILE.
862     (uniform-vector-read! raw (open-input-file file))
863
864     ;; Pass the u8vector to the import procedure.
865     (import-proc raw openpgp-certificate-format/base64)))
866
867
868 (define (import-public-key-from-file file)
869   (import-key-from-file import-openpgp-certificate file))
870
871 (define (import-private-key-from-file file)
872   (import-key-from-file import-openpgp-private-key file))
873 </pre></div>
874
875 <p>The procedures <code>import-public-key-from-file</code> and
876 <code>import-private-key-from-file</code> can be passed a file name.  They
877 return an OpenPGP public key and private key object, respectively
878 (see <a href="#Guile-Reference">OpenPGP key objects</a>).
879 </p>
880
881 <hr>
882 <a name="Guile-Reference"></a>
883 <div class="header">
884 <p>
885 Next: <a href="#Copying-Information" accesskey="n" rel="next">Copying Information</a>, Previous: <a href="#Guile-Examples" accesskey="p" rel="previous">Guile Examples</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
886 </div>
887 <a name="Guile-Reference-1"></a>
888 <h2 class="chapter">5 Guile Reference</h2>
889
890 <p>This chapter lists the GnuTLS Scheme procedures exported by the
891 <code>(gnutls)</code> module (see <a href="http://www.gnu.org/software/guile/manual/guile.html#The-Guile-module-system">The Guile module system</a> in <cite>The
892 GNU Guile Reference Manual</cite>).
893 </p>
894
895 <dl>
896 <dt><a name="index-set_002dlog_002dlevel_0021"></a>Scheme Procedure: <strong>set-log-level!</strong> <em>level</em></dt>
897 <dd><p>Enable GnuTLS logging up to <var>level</var> (an integer).
898 </p></dd></dl>
899
900 <dl>
901 <dt><a name="index-set_002dlog_002dprocedure_0021"></a>Scheme Procedure: <strong>set-log-procedure!</strong> <em>proc</em></dt>
902 <dd><p>Use <var>proc</var> (a two-argument procedure) as the global GnuTLS log procedure.
903 </p></dd></dl>
904
905 <dl>
906 <dt><a name="index-set_002dcertificate_002dcredentials_002dopenpgp_002dkeys_0021"></a>Scheme Procedure: <strong>set-certificate-credentials-openpgp-keys!</strong> <em>cred pub sec</em></dt>
907 <dd><p>Use certificate <var>pub</var> and secret key <var>sec</var> in certificate credentials <var>cred</var>.
908 </p></dd></dl>
909
910 <dl>
911 <dt><a name="index-openpgp_002dkeyring_002dcontains_002dkey_002did_003f"></a>Scheme Procedure: <strong>openpgp-keyring-contains-key-id?</strong> <em>keyring id</em></dt>
912 <dd><p>Return <code>#f</code> if key ID <var>id</var> is in <var>keyring</var>, <code>#f</code> otherwise.
913 </p></dd></dl>
914
915 <dl>
916 <dt><a name="index-import_002dopenpgp_002dkeyring"></a>Scheme Procedure: <strong>import-openpgp-keyring</strong> <em>data format</em></dt>
917 <dd><p>Import <var>data</var> (a u8vector) according to <var>format</var> and return the imported keyring.
918 </p></dd></dl>
919
920 <dl>
921 <dt><a name="index-openpgp_002dcertificate_002dusage"></a>Scheme Procedure: <strong>openpgp-certificate-usage</strong> <em>key</em></dt>
922 <dd><p>Return a list of values denoting the key usage of <var>key</var>.
923 </p></dd></dl>
924
925 <dl>
926 <dt><a name="index-openpgp_002dcertificate_002dversion"></a>Scheme Procedure: <strong>openpgp-certificate-version</strong> <em>key</em></dt>
927 <dd><p>Return the version of the OpenPGP message format (RFC2440) honored by <var>key</var>.
928 </p></dd></dl>
929
930 <dl>
931 <dt><a name="index-openpgp_002dcertificate_002dalgorithm"></a>Scheme Procedure: <strong>openpgp-certificate-algorithm</strong> <em>key</em></dt>
932 <dd><p>Return two values: the certificate algorithm used by <var>key</var> and the number of bits used.
933 </p></dd></dl>
934
935 <dl>
936 <dt><a name="index-openpgp_002dcertificate_002dnames"></a>Scheme Procedure: <strong>openpgp-certificate-names</strong> <em>key</em></dt>
937 <dd><p>Return the list of names for <var>key</var>.
938 </p></dd></dl>
939
940 <dl>
941 <dt><a name="index-openpgp_002dcertificate_002dname"></a>Scheme Procedure: <strong>openpgp-certificate-name</strong> <em>key index</em></dt>
942 <dd><p>Return the <var>index</var>th name of <var>key</var>.
943 </p></dd></dl>
944
945 <dl>
946 <dt><a name="index-openpgp_002dcertificate_002dfingerprint"></a>Scheme Procedure: <strong>openpgp-certificate-fingerprint</strong> <em>key</em></dt>
947 <dd><p>Return a new u8vector denoting the fingerprint of <var>key</var>.
948 </p></dd></dl>
949
950 <dl>
951 <dt><a name="index-openpgp_002dcertificate_002dfingerprint_0021"></a>Scheme Procedure: <strong>openpgp-certificate-fingerprint!</strong> <em>key fpr</em></dt>
952 <dd><p>Store in <var>fpr</var> (a u8vector) the fingerprint of <var>key</var>.  Return the number of bytes stored in <var>fpr</var>.
953 </p></dd></dl>
954
955 <dl>
956 <dt><a name="index-openpgp_002dcertificate_002did_0021"></a>Scheme Procedure: <strong>openpgp-certificate-id!</strong> <em>key id</em></dt>
957 <dd><p>Store the ID (an 8 byte sequence) of certificate <var>key</var> in <var>id</var> (a u8vector).
958 </p></dd></dl>
959
960 <dl>
961 <dt><a name="index-openpgp_002dcertificate_002did"></a>Scheme Procedure: <strong>openpgp-certificate-id</strong> <em>key</em></dt>
962 <dd><p>Return the ID (an 8-element u8vector) of certificate <var>key</var>.
963 </p></dd></dl>
964
965 <dl>
966 <dt><a name="index-import_002dopenpgp_002dprivate_002dkey"></a>Scheme Procedure: <strong>import-openpgp-private-key</strong> <em>data format [pass]</em></dt>
967 <dd><p>Return a new OpenPGP private key object resulting from the import of <var>data</var> (a uniform array) according to <var>format</var>.  Optionally, a passphrase may be provided.
968 </p></dd></dl>
969
970 <dl>
971 <dt><a name="index-import_002dopenpgp_002dcertificate"></a>Scheme Procedure: <strong>import-openpgp-certificate</strong> <em>data format</em></dt>
972 <dd><p>Return a new OpenPGP certificate object resulting from the import of <var>data</var> (a uniform array) according to <var>format</var>.
973 </p></dd></dl>
974
975 <dl>
976 <dt><a name="index-x509_002dcertificate_002dsubject_002dalternative_002dname"></a>Scheme Procedure: <strong>x509-certificate-subject-alternative-name</strong> <em>cert index</em></dt>
977 <dd><p>Return two values: the alternative name type for <var>cert</var> (i.e., one of the <code>x509-subject-alternative-name/</code> values) and the actual subject alternative name (a string) at <var>index</var>. Both values are <code>#f</code> if no alternative name is available at <var>index</var>.
978 </p></dd></dl>
979
980 <dl>
981 <dt><a name="index-x509_002dcertificate_002dsubject_002dkey_002did"></a>Scheme Procedure: <strong>x509-certificate-subject-key-id</strong> <em>cert</em></dt>
982 <dd><p>Return the subject key ID (a u8vector) for <var>cert</var>.
983 </p></dd></dl>
984
985 <dl>
986 <dt><a name="index-x509_002dcertificate_002dauthority_002dkey_002did"></a>Scheme Procedure: <strong>x509-certificate-authority-key-id</strong> <em>cert</em></dt>
987 <dd><p>Return the key ID (a u8vector) of the X.509 certificate authority of <var>cert</var>.
988 </p></dd></dl>
989
990 <dl>
991 <dt><a name="index-x509_002dcertificate_002dkey_002did"></a>Scheme Procedure: <strong>x509-certificate-key-id</strong> <em>cert</em></dt>
992 <dd><p>Return a statistically unique ID (a u8vector) for <var>cert</var> that depends on its public key parameters.  This is normally a 20-byte SHA-1 hash.
993 </p></dd></dl>
994
995 <dl>
996 <dt><a name="index-x509_002dcertificate_002dversion"></a>Scheme Procedure: <strong>x509-certificate-version</strong> <em>cert</em></dt>
997 <dd><p>Return the version of <var>cert</var>.
998 </p></dd></dl>
999
1000 <dl>
1001 <dt><a name="index-x509_002dcertificate_002dkey_002dusage"></a>Scheme Procedure: <strong>x509-certificate-key-usage</strong> <em>cert</em></dt>
1002 <dd><p>Return the key usage of <var>cert</var> (i.e., a list of <code>key-usage/</code> values), or the empty list if <var>cert</var> does not contain such information.
1003 </p></dd></dl>
1004
1005 <dl>
1006 <dt><a name="index-x509_002dcertificate_002dpublic_002dkey_002dalgorithm"></a>Scheme Procedure: <strong>x509-certificate-public-key-algorithm</strong> <em>cert</em></dt>
1007 <dd><p>Return two values: the public key algorithm (i.e., one of the <code>pk-algorithm/</code> values) of <var>cert</var> and the number of bits used.
1008 </p></dd></dl>
1009
1010 <dl>
1011 <dt><a name="index-x509_002dcertificate_002dsignature_002dalgorithm"></a>Scheme Procedure: <strong>x509-certificate-signature-algorithm</strong> <em>cert</em></dt>
1012 <dd><p>Return the signature algorithm used by <var>cert</var> (i.e., one of the <code>sign-algorithm/</code> values).
1013 </p></dd></dl>
1014
1015 <dl>
1016 <dt><a name="index-x509_002dcertificate_002dmatches_002dhostname_003f"></a>Scheme Procedure: <strong>x509-certificate-matches-hostname?</strong> <em>cert hostname</em></dt>
1017 <dd><p>Return true if <var>cert</var> matches <var>hostname</var>, a string denoting a DNS host name.  This is the basic implementation of <a href="http://tools.ietf.org/html/rfc2818">RFC 2818</a> (aka. HTTPS).
1018 </p></dd></dl>
1019
1020 <dl>
1021 <dt><a name="index-x509_002dcertificate_002dissuer_002ddn_002doid"></a>Scheme Procedure: <strong>x509-certificate-issuer-dn-oid</strong> <em>cert index</em></dt>
1022 <dd><p>Return the OID (a string) at <var>index</var> from <var>cert</var>&rsquo;s issuer DN.  Return <code>#f</code> if no OID is available at <var>index</var>.
1023 </p></dd></dl>
1024
1025 <dl>
1026 <dt><a name="index-x509_002dcertificate_002ddn_002doid"></a>Scheme Procedure: <strong>x509-certificate-dn-oid</strong> <em>cert index</em></dt>
1027 <dd><p>Return OID (a string) at <var>index</var> from <var>cert</var>.  Return <code>#f</code> if no OID is available at <var>index</var>.
1028 </p></dd></dl>
1029
1030 <dl>
1031 <dt><a name="index-x509_002dcertificate_002dissuer_002ddn"></a>Scheme Procedure: <strong>x509-certificate-issuer-dn</strong> <em>cert</em></dt>
1032 <dd><p>Return the distinguished name (DN) of X.509 certificate <var>cert</var>.
1033 </p></dd></dl>
1034
1035 <dl>
1036 <dt><a name="index-x509_002dcertificate_002ddn"></a>Scheme Procedure: <strong>x509-certificate-dn</strong> <em>cert</em></dt>
1037 <dd><p>Return the distinguished name (DN) of X.509 certificate <var>cert</var>.  The form of the DN is as described in <a href="http://tools.ietf.org/html/rfc2253">RFC 2253</a>.
1038 </p></dd></dl>
1039
1040 <dl>
1041 <dt><a name="index-pkcs8_002dimport_002dx509_002dprivate_002dkey"></a>Scheme Procedure: <strong>pkcs8-import-x509-private-key</strong> <em>data format [pass [encrypted]]</em></dt>
1042 <dd><p>Return a new X.509 private key object resulting from the import of <var>data</var> (a uniform array) according to <var>format</var>.  Optionally, if <var>pass</var> is not <code>#f</code>, it should be a string denoting a passphrase.  <var>encrypted</var> tells whether the private key is encrypted (<code>#t</code> by default).
1043 </p></dd></dl>
1044
1045 <dl>
1046 <dt><a name="index-import_002dx509_002dprivate_002dkey"></a>Scheme Procedure: <strong>import-x509-private-key</strong> <em>data format</em></dt>
1047 <dd><p>Return a new X.509 private key object resulting from the import of <var>data</var> (a uniform array) according to <var>format</var>.
1048 </p></dd></dl>
1049
1050 <dl>
1051 <dt><a name="index-import_002dx509_002dcertificate"></a>Scheme Procedure: <strong>import-x509-certificate</strong> <em>data format</em></dt>
1052 <dd><p>Return a new X.509 certificate object resulting from the import of <var>data</var> (a uniform array) according to <var>format</var>.
1053 </p></dd></dl>
1054
1055 <dl>
1056 <dt><a name="index-server_002dsession_002dpsk_002dusername"></a>Scheme Procedure: <strong>server-session-psk-username</strong> <em>session</em></dt>
1057 <dd><p>Return the username associated with PSK server session <var>session</var>.
1058 </p></dd></dl>
1059
1060 <dl>
1061 <dt><a name="index-set_002dpsk_002dclient_002dcredentials_0021"></a>Scheme Procedure: <strong>set-psk-client-credentials!</strong> <em>cred username key key-format</em></dt>
1062 <dd><p>Set the client credentials for <var>cred</var>, a PSK client credentials object.
1063 </p></dd></dl>
1064
1065 <dl>
1066 <dt><a name="index-make_002dpsk_002dclient_002dcredentials"></a>Scheme Procedure: <strong>make-psk-client-credentials</strong></dt>
1067 <dd><p>Return a new PSK client credentials object.
1068 </p></dd></dl>
1069
1070 <dl>
1071 <dt><a name="index-set_002dpsk_002dserver_002dcredentials_002dfile_0021"></a>Scheme Procedure: <strong>set-psk-server-credentials-file!</strong> <em>cred file</em></dt>
1072 <dd><p>Use <var>file</var> as the password file for PSK server credentials <var>cred</var>.
1073 </p></dd></dl>
1074
1075 <dl>
1076 <dt><a name="index-make_002dpsk_002dserver_002dcredentials"></a>Scheme Procedure: <strong>make-psk-server-credentials</strong></dt>
1077 <dd><p>Return new PSK server credentials.
1078 </p></dd></dl>
1079
1080 <dl>
1081 <dt><a name="index-peer_002dcertificate_002dstatus"></a>Scheme Procedure: <strong>peer-certificate-status</strong> <em>session</em></dt>
1082 <dd><p>Verify the peer certificate for <var>session</var> and return a list of <code>certificate-status</code> values (such as <code>certificate-status/revoked</code>), or the empty list if the certificate is valid.
1083 </p></dd></dl>
1084
1085 <dl>
1086 <dt><a name="index-set_002dcertificate_002dcredentials_002dverify_002dflags_0021"></a>Scheme Procedure: <strong>set-certificate-credentials-verify-flags!</strong> <em>cred [flags...]</em></dt>
1087 <dd><p>Set the certificate verification flags to <var>flags</var>, a series of <code>certificate-verify</code> values.
1088 </p></dd></dl>
1089
1090 <dl>
1091 <dt><a name="index-set_002dcertificate_002dcredentials_002dverify_002dlimits_0021"></a>Scheme Procedure: <strong>set-certificate-credentials-verify-limits!</strong> <em>cred max-bits max-depth</em></dt>
1092 <dd><p>Set the verification limits of <code>peer-certificate-status</code> for certificate credentials <var>cred</var> to <var>max_bits</var> bits for an acceptable certificate and <var>max_depth</var> as the maximum depth of a certificate chain.
1093 </p></dd></dl>
1094
1095 <dl>
1096 <dt><a name="index-set_002dcertificate_002dcredentials_002dx509_002dkeys_0021"></a>Scheme Procedure: <strong>set-certificate-credentials-x509-keys!</strong> <em>cred certs privkey</em></dt>
1097 <dd><p>Have certificate credentials <var>cred</var> use the X.509 certificates listed in <var>certs</var> and X.509 private key <var>privkey</var>.
1098 </p></dd></dl>
1099
1100 <dl>
1101 <dt><a name="index-set_002dcertificate_002dcredentials_002dx509_002dkey_002ddata_0021"></a>Scheme Procedure: <strong>set-certificate-credentials-x509-key-data!</strong> <em>cred cert key format</em></dt>
1102 <dd><p>Use X.509 certificate <var>cert</var> and private key <var>key</var>, both uniform arrays containing the X.509 certificate and key in format <var>format</var>, for certificate credentials <var>cred</var>.
1103 </p></dd></dl>
1104
1105 <dl>
1106 <dt><a name="index-set_002dcertificate_002dcredentials_002dx509_002dcrl_002ddata_0021"></a>Scheme Procedure: <strong>set-certificate-credentials-x509-crl-data!</strong> <em>cred data format</em></dt>
1107 <dd><p>Use <var>data</var> (a uniform array) as the X.509 CRL (certificate revocation list) database for <var>cred</var>.  On success, return the number of CRLs processed.
1108 </p></dd></dl>
1109
1110 <dl>
1111 <dt><a name="index-set_002dcertificate_002dcredentials_002dx509_002dtrust_002ddata_0021"></a>Scheme Procedure: <strong>set-certificate-credentials-x509-trust-data!</strong> <em>cred data format</em></dt>
1112 <dd><p>Use <var>data</var> (a uniform array) as the X.509 trust database for <var>cred</var>.  On success, return the number of certificates processed.
1113 </p></dd></dl>
1114
1115 <dl>
1116 <dt><a name="index-set_002dcertificate_002dcredentials_002dx509_002dcrl_002dfile_0021"></a>Scheme Procedure: <strong>set-certificate-credentials-x509-crl-file!</strong> <em>cred file format</em></dt>
1117 <dd><p>Use <var>file</var> as the X.509 CRL (certificate revocation list) file for certificate credentials <var>cred</var>.  On success, return the number of CRLs processed.
1118 </p></dd></dl>
1119
1120 <dl>
1121 <dt><a name="index-set_002dcertificate_002dcredentials_002dx509_002dtrust_002dfile_0021"></a>Scheme Procedure: <strong>set-certificate-credentials-x509-trust-file!</strong> <em>cred file format</em></dt>
1122 <dd><p>Use <var>file</var> as the X.509 trust file for certificate credentials <var>cred</var>.  On success, return the number of certificates processed.
1123 </p></dd></dl>
1124
1125 <dl>
1126 <dt><a name="index-set_002dcertificate_002dcredentials_002dx509_002dkey_002dfiles_0021"></a>Scheme Procedure: <strong>set-certificate-credentials-x509-key-files!</strong> <em>cred cert-file key-file format</em></dt>
1127 <dd><p>Use <var>file</var> as the password file for PSK server credentials <var>cred</var>.
1128 </p></dd></dl>
1129
1130 <dl>
1131 <dt><a name="index-set_002dcertificate_002dcredentials_002drsa_002dexport_002dparameters_0021"></a>Scheme Procedure: <strong>set-certificate-credentials-rsa-export-parameters!</strong> <em>cred rsa-params</em></dt>
1132 <dd><p>Use RSA parameters <var>rsa_params</var> for certificate credentials <var>cred</var>.
1133 </p></dd></dl>
1134
1135 <dl>
1136 <dt><a name="index-set_002dcertificate_002dcredentials_002ddh_002dparameters_0021"></a>Scheme Procedure: <strong>set-certificate-credentials-dh-parameters!</strong> <em>cred dh-params</em></dt>
1137 <dd><p>Use Diffie-Hellman parameters <var>dh_params</var> for certificate credentials <var>cred</var>.
1138 </p></dd></dl>
1139
1140 <dl>
1141 <dt><a name="index-make_002dcertificate_002dcredentials"></a>Scheme Procedure: <strong>make-certificate-credentials</strong></dt>
1142 <dd><p>Return new certificate credentials (i.e., for use with either X.509 or OpenPGP certificates.
1143 </p></dd></dl>
1144
1145 <dl>
1146 <dt><a name="index-pkcs1_002dexport_002drsa_002dparameters-1"></a>Scheme Procedure: <strong>pkcs1-export-rsa-parameters</strong> <em>rsa-params format</em></dt>
1147 <dd><p>Export Diffie-Hellman parameters <var>rsa_params</var> in PKCS1 format according for <var>format</var> (an <code>x509-certificate-format</code> value).  Return a <code>u8vector</code> containing the result.
1148 </p></dd></dl>
1149
1150 <dl>
1151 <dt><a name="index-pkcs1_002dimport_002drsa_002dparameters"></a>Scheme Procedure: <strong>pkcs1-import-rsa-parameters</strong> <em>array format</em></dt>
1152 <dd><p>Import Diffie-Hellman parameters in PKCS1 format (further specified by <var>format</var>, an <code>x509-certificate-format</code> value) from <var>array</var> (a homogeneous array) and return a new <code>rsa-params</code> object.
1153 </p></dd></dl>
1154
1155 <dl>
1156 <dt><a name="index-make_002drsa_002dparameters-1"></a>Scheme Procedure: <strong>make-rsa-parameters</strong> <em>bits</em></dt>
1157 <dd><p>Return new RSA parameters.
1158 </p></dd></dl>
1159
1160 <dl>
1161 <dt><a name="index-set_002danonymous_002dserver_002ddh_002dparameters_0021"></a>Scheme Procedure: <strong>set-anonymous-server-dh-parameters!</strong> <em>cred dh-params</em></dt>
1162 <dd><p>Set the Diffie-Hellman parameters of anonymous server credentials <var>cred</var>.
1163 </p></dd></dl>
1164
1165 <dl>
1166 <dt><a name="index-make_002danonymous_002dclient_002dcredentials"></a>Scheme Procedure: <strong>make-anonymous-client-credentials</strong></dt>
1167 <dd><p>Return anonymous client credentials.
1168 </p></dd></dl>
1169
1170 <dl>
1171 <dt><a name="index-make_002danonymous_002dserver_002dcredentials"></a>Scheme Procedure: <strong>make-anonymous-server-credentials</strong></dt>
1172 <dd><p>Return anonymous server credentials.
1173 </p></dd></dl>
1174
1175 <dl>
1176 <dt><a name="index-set_002dsession_002ddh_002dprime_002dbits_0021"></a>Scheme Procedure: <strong>set-session-dh-prime-bits!</strong> <em>session bits</em></dt>
1177 <dd><p>Use <var>bits</var> DH prime bits for <var>session</var>.
1178 </p></dd></dl>
1179
1180 <dl>
1181 <dt><a name="index-pkcs3_002dexport_002ddh_002dparameters"></a>Scheme Procedure: <strong>pkcs3-export-dh-parameters</strong> <em>dh-params format</em></dt>
1182 <dd><p>Export Diffie-Hellman parameters <var>dh_params</var> in PKCS3 format according for <var>format</var> (an <code>x509-certificate-format</code> value).  Return a <code>u8vector</code> containing the result.
1183 </p></dd></dl>
1184
1185 <dl>
1186 <dt><a name="index-pkcs3_002dimport_002ddh_002dparameters"></a>Scheme Procedure: <strong>pkcs3-import-dh-parameters</strong> <em>array format</em></dt>
1187 <dd><p>Import Diffie-Hellman parameters in PKCS3 format (further specified by <var>format</var>, an <code>x509-certificate-format</code> value) from <var>array</var> (a homogeneous array) and return a new <code>dh-params</code> object.
1188 </p></dd></dl>
1189
1190 <dl>
1191 <dt><a name="index-make_002ddh_002dparameters"></a>Scheme Procedure: <strong>make-dh-parameters</strong> <em>bits</em></dt>
1192 <dd><p>Return new Diffie-Hellman parameters.
1193 </p></dd></dl>
1194
1195 <dl>
1196 <dt><a name="index-set_002dsession_002dtransport_002dport_0021-1"></a>Scheme Procedure: <strong>set-session-transport-port!</strong> <em>session port</em></dt>
1197 <dd><p>Use <var>port</var> as the input/output port for <var>session</var>.
1198 </p></dd></dl>
1199
1200 <dl>
1201 <dt><a name="index-set_002dsession_002dtransport_002dfd_0021-1"></a>Scheme Procedure: <strong>set-session-transport-fd!</strong> <em>session fd</em></dt>
1202 <dd><p>Use file descriptor <var>fd</var> as the underlying transport for <var>session</var>.
1203 </p></dd></dl>
1204
1205 <dl>
1206 <dt><a name="index-session_002drecord_002dport-1"></a>Scheme Procedure: <strong>session-record-port</strong> <em>session</em></dt>
1207 <dd><p>Return a read-write port that may be used to communicate over <var>session</var>.  All invocations of <code>session-port</code> on a given session return the same object (in the sense of <code>eq?</code>).
1208 </p></dd></dl>
1209
1210 <dl>
1211 <dt><a name="index-record_002dreceive_0021-1"></a>Scheme Procedure: <strong>record-receive!</strong> <em>session array</em></dt>
1212 <dd><p>Receive data from <var>session</var> into <var>array</var>, a uniform homogeneous array.  Return the number of bytes actually received.
1213 </p></dd></dl>
1214
1215 <dl>
1216 <dt><a name="index-record_002dsend-1"></a>Scheme Procedure: <strong>record-send</strong> <em>session array</em></dt>
1217 <dd><p>Send the record constituted by <var>array</var> through <var>session</var>.
1218 </p></dd></dl>
1219
1220 <dl>
1221 <dt><a name="index-set_002dsession_002dcredentials_0021"></a>Scheme Procedure: <strong>set-session-credentials!</strong> <em>session cred</em></dt>
1222 <dd><p>Use <var>cred</var> as <var>session</var>&rsquo;s credentials.
1223 </p></dd></dl>
1224
1225 <dl>
1226 <dt><a name="index-cipher_002dsuite_002d_003estring"></a>Scheme Procedure: <strong>cipher-suite-&gt;string</strong> <em>kx cipher mac</em></dt>
1227 <dd><p>Return the name of the given cipher suite.
1228 </p></dd></dl>
1229
1230 <dl>
1231 <dt><a name="index-set_002dsession_002dpriorities_0021"></a>Scheme Procedure: <strong>set-session-priorities!</strong> <em>session priorities</em></dt>
1232 <dd><p>Have <var>session</var> use the given <var>priorities</var> for the ciphers, key exchange methods, MACs and compression methods.  <var>priorities</var> must be a string (see Priority Strings).  When <var>priorities</var> cannot be parsed, an <code>error/invalid-request</code> error is raised, with an extra argument indication the position of the error.
1233 </p>
1234 </dd></dl>
1235
1236 <dl>
1237 <dt><a name="index-set_002dsession_002ddefault_002dexport_002dpriority_0021"></a>Scheme Procedure: <strong>set-session-default-export-priority!</strong> <em>session</em></dt>
1238 <dd><p>Have <var>session</var> use the default export priorities.
1239 </p></dd></dl>
1240
1241 <dl>
1242 <dt><a name="index-set_002dsession_002ddefault_002dpriority_0021"></a>Scheme Procedure: <strong>set-session-default-priority!</strong> <em>session</em></dt>
1243 <dd><p>Have <var>session</var> use the default priorities.
1244 </p></dd></dl>
1245
1246 <dl>
1247 <dt><a name="index-set_002dsession_002dcertificate_002dtype_002dpriority_0021"></a>Scheme Procedure: <strong>set-session-certificate-type-priority!</strong> <em>session items</em></dt>
1248 <dd><p>Use <var>items</var> (a list) as the list of preferred certificate-type for <var>session</var>.
1249 </p></dd></dl>
1250
1251 <dl>
1252 <dt><a name="index-set_002dsession_002dprotocol_002dpriority_0021"></a>Scheme Procedure: <strong>set-session-protocol-priority!</strong> <em>session items</em></dt>
1253 <dd><p>Use <var>items</var> (a list) as the list of preferred protocol for <var>session</var>.
1254 </p></dd></dl>
1255
1256 <dl>
1257 <dt><a name="index-set_002dsession_002dkx_002dpriority_0021"></a>Scheme Procedure: <strong>set-session-kx-priority!</strong> <em>session items</em></dt>
1258 <dd><p>Use <var>items</var> (a list) as the list of preferred kx for <var>session</var>.
1259 </p></dd></dl>
1260
1261 <dl>
1262 <dt><a name="index-set_002dsession_002dcompression_002dmethod_002dpriority_0021"></a>Scheme Procedure: <strong>set-session-compression-method-priority!</strong> <em>session items</em></dt>
1263 <dd><p>Use <var>items</var> (a list) as the list of preferred compression-method for <var>session</var>.
1264 </p></dd></dl>
1265
1266 <dl>
1267 <dt><a name="index-set_002dsession_002dmac_002dpriority_0021"></a>Scheme Procedure: <strong>set-session-mac-priority!</strong> <em>session items</em></dt>
1268 <dd><p>Use <var>items</var> (a list) as the list of preferred mac for <var>session</var>.
1269 </p></dd></dl>
1270
1271 <dl>
1272 <dt><a name="index-set_002dsession_002dcipher_002dpriority_0021"></a>Scheme Procedure: <strong>set-session-cipher-priority!</strong> <em>session items</em></dt>
1273 <dd><p>Use <var>items</var> (a list) as the list of preferred cipher for <var>session</var>.
1274 </p></dd></dl>
1275
1276 <dl>
1277 <dt><a name="index-set_002dserver_002dsession_002dcertificate_002drequest_0021"></a>Scheme Procedure: <strong>set-server-session-certificate-request!</strong> <em>session request</em></dt>
1278 <dd><p>Tell how <var>session</var>, a server-side session, should deal with certificate requests.  <var>request</var> should be either <code>certificate-request/request</code> or <code>certificate-request/require</code>.
1279 </p></dd></dl>
1280
1281 <dl>
1282 <dt><a name="index-session_002dour_002dcertificate_002dchain"></a>Scheme Procedure: <strong>session-our-certificate-chain</strong> <em>session</em></dt>
1283 <dd><p>Return our certificate chain for <var>session</var> (as sent to the peer) in raw format (a u8vector).  In the case of OpenPGP there is exactly one certificate.  Return the empty list if no certificate was used.
1284 </p></dd></dl>
1285
1286 <dl>
1287 <dt><a name="index-session_002dpeer_002dcertificate_002dchain"></a>Scheme Procedure: <strong>session-peer-certificate-chain</strong> <em>session</em></dt>
1288 <dd><p>Return the a list of certificates in raw format (u8vectors) where the first one is the peer&rsquo;s certificate.  In the case of OpenPGP, there is always exactly one certificate.  In the case of X.509, subsequent certificates indicate form a certificate chain.  Return the empty list if no certificate was sent.
1289 </p></dd></dl>
1290
1291 <dl>
1292 <dt><a name="index-session_002dclient_002dauthentication_002dtype"></a>Scheme Procedure: <strong>session-client-authentication-type</strong> <em>session</em></dt>
1293 <dd><p>Return the client authentication type (a <code>credential-type</code> value) used in <var>session</var>.
1294 </p></dd></dl>
1295
1296 <dl>
1297 <dt><a name="index-session_002dserver_002dauthentication_002dtype"></a>Scheme Procedure: <strong>session-server-authentication-type</strong> <em>session</em></dt>
1298 <dd><p>Return the server authentication type (a <code>credential-type</code> value) used in <var>session</var>.
1299 </p></dd></dl>
1300
1301 <dl>
1302 <dt><a name="index-session_002dauthentication_002dtype"></a>Scheme Procedure: <strong>session-authentication-type</strong> <em>session</em></dt>
1303 <dd><p>Return the authentication type (a <code>credential-type</code> value) used by <var>session</var>.
1304 </p></dd></dl>
1305
1306 <dl>
1307 <dt><a name="index-session_002dprotocol"></a>Scheme Procedure: <strong>session-protocol</strong> <em>session</em></dt>
1308 <dd><p>Return the protocol used by <var>session</var>.
1309 </p></dd></dl>
1310
1311 <dl>
1312 <dt><a name="index-session_002dcertificate_002dtype"></a>Scheme Procedure: <strong>session-certificate-type</strong> <em>session</em></dt>
1313 <dd><p>Return <var>session</var>&rsquo;s certificate type.
1314 </p></dd></dl>
1315
1316 <dl>
1317 <dt><a name="index-session_002dcompression_002dmethod"></a>Scheme Procedure: <strong>session-compression-method</strong> <em>session</em></dt>
1318 <dd><p>Return <var>session</var>&rsquo;s compression method.
1319 </p></dd></dl>
1320
1321 <dl>
1322 <dt><a name="index-session_002dmac"></a>Scheme Procedure: <strong>session-mac</strong> <em>session</em></dt>
1323 <dd><p>Return <var>session</var>&rsquo;s MAC.
1324 </p></dd></dl>
1325
1326 <dl>
1327 <dt><a name="index-session_002dkx"></a>Scheme Procedure: <strong>session-kx</strong> <em>session</em></dt>
1328 <dd><p>Return <var>session</var>&rsquo;s kx.
1329 </p></dd></dl>
1330
1331 <dl>
1332 <dt><a name="index-session_002dcipher-1"></a>Scheme Procedure: <strong>session-cipher</strong> <em>session</em></dt>
1333 <dd><p>Return <var>session</var>&rsquo;s cipher.
1334 </p></dd></dl>
1335
1336 <dl>
1337 <dt><a name="index-alert_002dsend"></a>Scheme Procedure: <strong>alert-send</strong> <em>session level alert</em></dt>
1338 <dd><p>Send <var>alert</var> via <var>session</var>.
1339 </p></dd></dl>
1340
1341 <dl>
1342 <dt><a name="index-alert_002dget"></a>Scheme Procedure: <strong>alert-get</strong> <em>session</em></dt>
1343 <dd><p>Get an aleter from <var>session</var>.
1344 </p></dd></dl>
1345
1346 <dl>
1347 <dt><a name="index-rehandshake"></a>Scheme Procedure: <strong>rehandshake</strong> <em>session</em></dt>
1348 <dd><p>Perform a re-handshaking for <var>session</var>.
1349 </p></dd></dl>
1350
1351 <dl>
1352 <dt><a name="index-handshake"></a>Scheme Procedure: <strong>handshake</strong> <em>session</em></dt>
1353 <dd><p>Perform a handshake for <var>session</var>.
1354 </p></dd></dl>
1355
1356 <dl>
1357 <dt><a name="index-bye"></a>Scheme Procedure: <strong>bye</strong> <em>session how</em></dt>
1358 <dd><p>Close <var>session</var> according to <var>how</var>.
1359 </p></dd></dl>
1360
1361 <dl>
1362 <dt><a name="index-make_002dsession"></a>Scheme Procedure: <strong>make-session</strong> <em>end</em></dt>
1363 <dd><p>Return a new session for connection end <var>end</var>, either <code>connection-end/server</code> or <code>connection-end/client</code>.
1364 </p></dd></dl>
1365
1366 <dl>
1367 <dt><a name="index-gnutls_002dversion"></a>Scheme Procedure: <strong>gnutls-version</strong></dt>
1368 <dd><p>Return a string denoting the version number of the underlying GnuTLS library, e.g., <code>&quot;1.7.2&quot;</code>.
1369 </p></dd></dl>
1370
1371 <dl>
1372 <dt><a name="index-openpgp_002dkeyring_003f"></a>Scheme Procedure: <strong>openpgp-keyring?</strong> <em>obj</em></dt>
1373 <dd><p>Return true if <var>obj</var> is of type <code>openpgp-keyring</code>.
1374 </p></dd></dl>
1375
1376 <dl>
1377 <dt><a name="index-openpgp_002dprivate_002dkey_003f"></a>Scheme Procedure: <strong>openpgp-private-key?</strong> <em>obj</em></dt>
1378 <dd><p>Return true if <var>obj</var> is of type <code>openpgp-private-key</code>.
1379 </p></dd></dl>
1380
1381 <dl>
1382 <dt><a name="index-openpgp_002dcertificate_003f"></a>Scheme Procedure: <strong>openpgp-certificate?</strong> <em>obj</em></dt>
1383 <dd><p>Return true if <var>obj</var> is of type <code>openpgp-certificate</code>.
1384 </p></dd></dl>
1385
1386 <dl>
1387 <dt><a name="index-x509_002dprivate_002dkey_003f"></a>Scheme Procedure: <strong>x509-private-key?</strong> <em>obj</em></dt>
1388 <dd><p>Return true if <var>obj</var> is of type <code>x509-private-key</code>.
1389 </p></dd></dl>
1390
1391 <dl>
1392 <dt><a name="index-x509_002dcertificate_003f"></a>Scheme Procedure: <strong>x509-certificate?</strong> <em>obj</em></dt>
1393 <dd><p>Return true if <var>obj</var> is of type <code>x509-certificate</code>.
1394 </p></dd></dl>
1395
1396 <dl>
1397 <dt><a name="index-psk_002dclient_002dcredentials_003f"></a>Scheme Procedure: <strong>psk-client-credentials?</strong> <em>obj</em></dt>
1398 <dd><p>Return true if <var>obj</var> is of type <code>psk-client-credentials</code>.
1399 </p></dd></dl>
1400
1401 <dl>
1402 <dt><a name="index-psk_002dserver_002dcredentials_003f"></a>Scheme Procedure: <strong>psk-server-credentials?</strong> <em>obj</em></dt>
1403 <dd><p>Return true if <var>obj</var> is of type <code>psk-server-credentials</code>.
1404 </p></dd></dl>
1405
1406 <dl>
1407 <dt><a name="index-srp_002dclient_002dcredentials_003f"></a>Scheme Procedure: <strong>srp-client-credentials?</strong> <em>obj</em></dt>
1408 <dd><p>Return true if <var>obj</var> is of type <code>srp-client-credentials</code>.
1409 </p></dd></dl>
1410
1411 <dl>
1412 <dt><a name="index-srp_002dserver_002dcredentials_003f"></a>Scheme Procedure: <strong>srp-server-credentials?</strong> <em>obj</em></dt>
1413 <dd><p>Return true if <var>obj</var> is of type <code>srp-server-credentials</code>.
1414 </p></dd></dl>
1415
1416 <dl>
1417 <dt><a name="index-certificate_002dcredentials_003f"></a>Scheme Procedure: <strong>certificate-credentials?</strong> <em>obj</em></dt>
1418 <dd><p>Return true if <var>obj</var> is of type <code>certificate-credentials</code>.
1419 </p></dd></dl>
1420
1421 <dl>
1422 <dt><a name="index-rsa_002dparameters_003f"></a>Scheme Procedure: <strong>rsa-parameters?</strong> <em>obj</em></dt>
1423 <dd><p>Return true if <var>obj</var> is of type <code>rsa-parameters</code>.
1424 </p></dd></dl>
1425
1426 <dl>
1427 <dt><a name="index-dh_002dparameters_003f"></a>Scheme Procedure: <strong>dh-parameters?</strong> <em>obj</em></dt>
1428 <dd><p>Return true if <var>obj</var> is of type <code>dh-parameters</code>.
1429 </p></dd></dl>
1430
1431 <dl>
1432 <dt><a name="index-anonymous_002dserver_002dcredentials_003f"></a>Scheme Procedure: <strong>anonymous-server-credentials?</strong> <em>obj</em></dt>
1433 <dd><p>Return true if <var>obj</var> is of type <code>anonymous-server-credentials</code>.
1434 </p></dd></dl>
1435
1436 <dl>
1437 <dt><a name="index-anonymous_002dclient_002dcredentials_003f"></a>Scheme Procedure: <strong>anonymous-client-credentials?</strong> <em>obj</em></dt>
1438 <dd><p>Return true if <var>obj</var> is of type <code>anonymous-client-credentials</code>.
1439 </p></dd></dl>
1440
1441 <dl>
1442 <dt><a name="index-session_003f"></a>Scheme Procedure: <strong>session?</strong> <em>obj</em></dt>
1443 <dd><p>Return true if <var>obj</var> is of type <code>session</code>.
1444 </p></dd></dl>
1445
1446 <dl>
1447 <dt><a name="index-openpgp_002dcertificate_002dformat_002d_003estring"></a>Scheme Procedure: <strong>openpgp-certificate-format-&gt;string</strong> <em>enumval</em></dt>
1448 <dd><p>Return a string describing <var>enumval</var>, a <code>openpgp-certificate-format</code> value.
1449 </p></dd></dl>
1450
1451 <dl>
1452 <dt><a name="index-error_002d_003estring-1"></a>Scheme Procedure: <strong>error-&gt;string</strong> <em>enumval</em></dt>
1453 <dd><p>Return a string describing <var>enumval</var>, a <code>error</code> value.
1454 </p></dd></dl>
1455
1456 <dl>
1457 <dt><a name="index-certificate_002dverify_002d_003estring"></a>Scheme Procedure: <strong>certificate-verify-&gt;string</strong> <em>enumval</em></dt>
1458 <dd><p>Return a string describing <var>enumval</var>, a <code>certificate-verify</code> value.
1459 </p></dd></dl>
1460
1461 <dl>
1462 <dt><a name="index-key_002dusage_002d_003estring"></a>Scheme Procedure: <strong>key-usage-&gt;string</strong> <em>enumval</em></dt>
1463 <dd><p>Return a string describing <var>enumval</var>, a <code>key-usage</code> value.
1464 </p></dd></dl>
1465
1466 <dl>
1467 <dt><a name="index-psk_002dkey_002dformat_002d_003estring"></a>Scheme Procedure: <strong>psk-key-format-&gt;string</strong> <em>enumval</em></dt>
1468 <dd><p>Return a string describing <var>enumval</var>, a <code>psk-key-format</code> value.
1469 </p></dd></dl>
1470
1471 <dl>
1472 <dt><a name="index-sign_002dalgorithm_002d_003estring"></a>Scheme Procedure: <strong>sign-algorithm-&gt;string</strong> <em>enumval</em></dt>
1473 <dd><p>Return a string describing <var>enumval</var>, a <code>sign-algorithm</code> value.
1474 </p></dd></dl>
1475
1476 <dl>
1477 <dt><a name="index-pk_002dalgorithm_002d_003estring"></a>Scheme Procedure: <strong>pk-algorithm-&gt;string</strong> <em>enumval</em></dt>
1478 <dd><p>Return a string describing <var>enumval</var>, a <code>pk-algorithm</code> value.
1479 </p></dd></dl>
1480
1481 <dl>
1482 <dt><a name="index-x509_002dsubject_002dalternative_002dname_002d_003estring"></a>Scheme Procedure: <strong>x509-subject-alternative-name-&gt;string</strong> <em>enumval</em></dt>
1483 <dd><p>Return a string describing <var>enumval</var>, a <code>x509-subject-alternative-name</code> value.
1484 </p></dd></dl>
1485
1486 <dl>
1487 <dt><a name="index-x509_002dcertificate_002dformat_002d_003estring"></a>Scheme Procedure: <strong>x509-certificate-format-&gt;string</strong> <em>enumval</em></dt>
1488 <dd><p>Return a string describing <var>enumval</var>, a <code>x509-certificate-format</code> value.
1489 </p></dd></dl>
1490
1491 <dl>
1492 <dt><a name="index-certificate_002dtype_002d_003estring"></a>Scheme Procedure: <strong>certificate-type-&gt;string</strong> <em>enumval</em></dt>
1493 <dd><p>Return a string describing <var>enumval</var>, a <code>certificate-type</code> value.
1494 </p></dd></dl>
1495
1496 <dl>
1497 <dt><a name="index-protocol_002d_003estring"></a>Scheme Procedure: <strong>protocol-&gt;string</strong> <em>enumval</em></dt>
1498 <dd><p>Return a string describing <var>enumval</var>, a <code>protocol</code> value.
1499 </p></dd></dl>
1500
1501 <dl>
1502 <dt><a name="index-close_002drequest_002d_003estring"></a>Scheme Procedure: <strong>close-request-&gt;string</strong> <em>enumval</em></dt>
1503 <dd><p>Return a string describing <var>enumval</var>, a <code>close-request</code> value.
1504 </p></dd></dl>
1505
1506 <dl>
1507 <dt><a name="index-certificate_002drequest_002d_003estring"></a>Scheme Procedure: <strong>certificate-request-&gt;string</strong> <em>enumval</em></dt>
1508 <dd><p>Return a string describing <var>enumval</var>, a <code>certificate-request</code> value.
1509 </p></dd></dl>
1510
1511 <dl>
1512 <dt><a name="index-certificate_002dstatus_002d_003estring"></a>Scheme Procedure: <strong>certificate-status-&gt;string</strong> <em>enumval</em></dt>
1513 <dd><p>Return a string describing <var>enumval</var>, a <code>certificate-status</code> value.
1514 </p></dd></dl>
1515
1516 <dl>
1517 <dt><a name="index-handshake_002ddescription_002d_003estring"></a>Scheme Procedure: <strong>handshake-description-&gt;string</strong> <em>enumval</em></dt>
1518 <dd><p>Return a string describing <var>enumval</var>, a <code>handshake-description</code> value.
1519 </p></dd></dl>
1520
1521 <dl>
1522 <dt><a name="index-alert_002ddescription_002d_003estring"></a>Scheme Procedure: <strong>alert-description-&gt;string</strong> <em>enumval</em></dt>
1523 <dd><p>Return a string describing <var>enumval</var>, a <code>alert-description</code> value.
1524 </p></dd></dl>
1525
1526 <dl>
1527 <dt><a name="index-alert_002dlevel_002d_003estring"></a>Scheme Procedure: <strong>alert-level-&gt;string</strong> <em>enumval</em></dt>
1528 <dd><p>Return a string describing <var>enumval</var>, a <code>alert-level</code> value.
1529 </p></dd></dl>
1530
1531 <dl>
1532 <dt><a name="index-connection_002dend_002d_003estring"></a>Scheme Procedure: <strong>connection-end-&gt;string</strong> <em>enumval</em></dt>
1533 <dd><p>Return a string describing <var>enumval</var>, a <code>connection-end</code> value.
1534 </p></dd></dl>
1535
1536 <dl>
1537 <dt><a name="index-compression_002dmethod_002d_003estring"></a>Scheme Procedure: <strong>compression-method-&gt;string</strong> <em>enumval</em></dt>
1538 <dd><p>Return a string describing <var>enumval</var>, a <code>compression-method</code> value.
1539 </p></dd></dl>
1540
1541 <dl>
1542 <dt><a name="index-digest_002d_003estring"></a>Scheme Procedure: <strong>digest-&gt;string</strong> <em>enumval</em></dt>
1543 <dd><p>Return a string describing <var>enumval</var>, a <code>digest</code> value.
1544 </p></dd></dl>
1545
1546 <dl>
1547 <dt><a name="index-mac_002d_003estring"></a>Scheme Procedure: <strong>mac-&gt;string</strong> <em>enumval</em></dt>
1548 <dd><p>Return a string describing <var>enumval</var>, a <code>mac</code> value.
1549 </p></dd></dl>
1550
1551 <dl>
1552 <dt><a name="index-credentials_002d_003estring"></a>Scheme Procedure: <strong>credentials-&gt;string</strong> <em>enumval</em></dt>
1553 <dd><p>Return a string describing <var>enumval</var>, a <code>credentials</code> value.
1554 </p></dd></dl>
1555
1556 <dl>
1557 <dt><a name="index-params_002d_003estring"></a>Scheme Procedure: <strong>params-&gt;string</strong> <em>enumval</em></dt>
1558 <dd><p>Return a string describing <var>enumval</var>, a <code>params</code> value.
1559 </p></dd></dl>
1560
1561 <dl>
1562 <dt><a name="index-kx_002d_003estring"></a>Scheme Procedure: <strong>kx-&gt;string</strong> <em>enumval</em></dt>
1563 <dd><p>Return a string describing <var>enumval</var>, a <code>kx</code> value.
1564 </p></dd></dl>
1565
1566 <dl>
1567 <dt><a name="index-cipher_002d_003estring"></a>Scheme Procedure: <strong>cipher-&gt;string</strong> <em>enumval</em></dt>
1568 <dd><p>Return a string describing <var>enumval</var>, a <code>cipher</code> value.
1569 </p></dd></dl>
1570
1571
1572 <hr>
1573 <a name="Copying-Information"></a>
1574 <div class="header">
1575 <p>
1576 Previous: <a href="#Guile-Reference" accesskey="p" rel="previous">Guile Reference</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
1577 </div>
1578 <a name="Copying-Information-1"></a>
1579 <h2 class="appendix">Appendix A Copying Information</h2>
1580 <a name="index-FDL_002c-GNU-Free-Documentation-License"></a>
1581
1582 <a name="GNU-Free-Documentation-License"></a>
1583 <h3 class="heading">GNU Free Documentation License</h3>
1584
1585 <div align="center">Version 1.3, 3 November 2008
1586 </div>
1587
1588 <div class="display">
1589 <pre class="display">Copyright &copy; 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
1590 <a href="http://fsf.org/">http://fsf.org/</a>
1591
1592 Everyone is permitted to copy and distribute verbatim copies
1593 of this license document, but changing it is not allowed.
1594 </pre></div>
1595
1596 <ol>
1597 <li> PREAMBLE
1598
1599 <p>The purpose of this License is to make a manual, textbook, or other
1600 functional and useful document <em>free</em> in the sense of freedom: to
1601 assure everyone the effective freedom to copy and redistribute it,
1602 with or without modifying it, either commercially or noncommercially.
1603 Secondarily, this License preserves for the author and publisher a way
1604 to get credit for their work, while not being considered responsible
1605 for modifications made by others.
1606 </p>
1607 <p>This License is a kind of &ldquo;copyleft&rdquo;, which means that derivative
1608 works of the document must themselves be free in the same sense.  It
1609 complements the GNU General Public License, which is a copyleft
1610 license designed for free software.
1611 </p>
1612 <p>We have designed this License in order to use it for manuals for free
1613 software, because free software needs free documentation: a free
1614 program should come with manuals providing the same freedoms that the
1615 software does.  But this License is not limited to software manuals;
1616 it can be used for any textual work, regardless of subject matter or
1617 whether it is published as a printed book.  We recommend this License
1618 principally for works whose purpose is instruction or reference.
1619 </p>
1620 </li><li> APPLICABILITY AND DEFINITIONS
1621
1622 <p>This License applies to any manual or other work, in any medium, that
1623 contains a notice placed by the copyright holder saying it can be
1624 distributed under the terms of this License.  Such a notice grants a
1625 world-wide, royalty-free license, unlimited in duration, to use that
1626 work under the conditions stated herein.  The &ldquo;Document&rdquo;, below,
1627 refers to any such manual or work.  Any member of the public is a
1628 licensee, and is addressed as &ldquo;you&rdquo;.  You accept the license if you
1629 copy, modify or distribute the work in a way requiring permission
1630 under copyright law.
1631 </p>
1632 <p>A &ldquo;Modified Version&rdquo; of the Document means any work containing the
1633 Document or a portion of it, either copied verbatim, or with
1634 modifications and/or translated into another language.
1635 </p>
1636 <p>A &ldquo;Secondary Section&rdquo; is a named appendix or a front-matter section
1637 of the Document that deals exclusively with the relationship of the
1638 publishers or authors of the Document to the Document&rsquo;s overall
1639 subject (or to related matters) and contains nothing that could fall
1640 directly within that overall subject.  (Thus, if the Document is in
1641 part a textbook of mathematics, a Secondary Section may not explain
1642 any mathematics.)  The relationship could be a matter of historical
1643 connection with the subject or with related matters, or of legal,
1644 commercial, philosophical, ethical or political position regarding
1645 them.
1646 </p>
1647 <p>The &ldquo;Invariant Sections&rdquo; are certain Secondary Sections whose titles
1648 are designated, as being those of Invariant Sections, in the notice
1649 that says that the Document is released under this License.  If a
1650 section does not fit the above definition of Secondary then it is not
1651 allowed to be designated as Invariant.  The Document may contain zero
1652 Invariant Sections.  If the Document does not identify any Invariant
1653 Sections then there are none.
1654 </p>
1655 <p>The &ldquo;Cover Texts&rdquo; are certain short passages of text that are listed,
1656 as Front-Cover Texts or Back-Cover Texts, in the notice that says that
1657 the Document is released under this License.  A Front-Cover Text may
1658 be at most 5 words, and a Back-Cover Text may be at most 25 words.
1659 </p>
1660 <p>A &ldquo;Transparent&rdquo; copy of the Document means a machine-readable copy,
1661 represented in a format whose specification is available to the
1662 general public, that is suitable for revising the document
1663 straightforwardly with generic text editors or (for images composed of
1664 pixels) generic paint programs or (for drawings) some widely available
1665 drawing editor, and that is suitable for input to text formatters or
1666 for automatic translation to a variety of formats suitable for input
1667 to text formatters.  A copy made in an otherwise Transparent file
1668 format whose markup, or absence of markup, has been arranged to thwart
1669 or discourage subsequent modification by readers is not Transparent.
1670 An image format is not Transparent if used for any substantial amount
1671 of text.  A copy that is not &ldquo;Transparent&rdquo; is called &ldquo;Opaque&rdquo;.
1672 </p>
1673 <p>Examples of suitable formats for Transparent copies include plain
1674 ASCII without markup, Texinfo input format, LaTeX input
1675 format, SGML or XML using a publicly available
1676 DTD, and standard-conforming simple HTML,
1677 PostScript or PDF designed for human modification.  Examples
1678 of transparent image formats include PNG, XCF and
1679 JPG.  Opaque formats include proprietary formats that can be
1680 read and edited only by proprietary word processors, SGML or
1681 XML for which the DTD and/or processing tools are
1682 not generally available, and the machine-generated HTML,
1683 PostScript or PDF produced by some word processors for
1684 output purposes only.
1685 </p>
1686 <p>The &ldquo;Title Page&rdquo; means, for a printed book, the title page itself,
1687 plus such following pages as are needed to hold, legibly, the material
1688 this License requires to appear in the title page.  For works in
1689 formats which do not have any title page as such, &ldquo;Title Page&rdquo; means
1690 the text near the most prominent appearance of the work&rsquo;s title,
1691 preceding the beginning of the body of the text.
1692 </p>
1693 <p>The &ldquo;publisher&rdquo; means any person or entity that distributes copies
1694 of the Document to the public.
1695 </p>
1696 <p>A section &ldquo;Entitled XYZ&rdquo; means a named subunit of the Document whose
1697 title either is precisely XYZ or contains XYZ in parentheses following
1698 text that translates XYZ in another language.  (Here XYZ stands for a
1699 specific section name mentioned below, such as &ldquo;Acknowledgements&rdquo;,
1700 &ldquo;Dedications&rdquo;, &ldquo;Endorsements&rdquo;, or &ldquo;History&rdquo;.)  To &ldquo;Preserve the Title&rdquo;
1701 of such a section when you modify the Document means that it remains a
1702 section &ldquo;Entitled XYZ&rdquo; according to this definition.
1703 </p>
1704 <p>The Document may include Warranty Disclaimers next to the notice which
1705 states that this License applies to the Document.  These Warranty
1706 Disclaimers are considered to be included by reference in this
1707 License, but only as regards disclaiming warranties: any other
1708 implication that these Warranty Disclaimers may have is void and has
1709 no effect on the meaning of this License.
1710 </p>
1711 </li><li> VERBATIM COPYING
1712
1713 <p>You may copy and distribute the Document in any medium, either
1714 commercially or noncommercially, provided that this License, the
1715 copyright notices, and the license notice saying this License applies
1716 to the Document are reproduced in all copies, and that you add no other
1717 conditions whatsoever to those of this License.  You may not use
1718 technical measures to obstruct or control the reading or further
1719 copying of the copies you make or distribute.  However, you may accept
1720 compensation in exchange for copies.  If you distribute a large enough
1721 number of copies you must also follow the conditions in section 3.
1722 </p>
1723 <p>You may also lend copies, under the same conditions stated above, and
1724 you may publicly display copies.
1725 </p>
1726 </li><li> COPYING IN QUANTITY
1727
1728 <p>If you publish printed copies (or copies in media that commonly have
1729 printed covers) of the Document, numbering more than 100, and the
1730 Document&rsquo;s license notice requires Cover Texts, you must enclose the
1731 copies in covers that carry, clearly and legibly, all these Cover
1732 Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
1733 the back cover.  Both covers must also clearly and legibly identify
1734 you as the publisher of these copies.  The front cover must present
1735 the full title with all words of the title equally prominent and
1736 visible.  You may add other material on the covers in addition.
1737 Copying with changes limited to the covers, as long as they preserve
1738 the title of the Document and satisfy these conditions, can be treated
1739 as verbatim copying in other respects.
1740 </p>
1741 <p>If the required texts for either cover are too voluminous to fit
1742 legibly, you should put the first ones listed (as many as fit
1743 reasonably) on the actual cover, and continue the rest onto adjacent
1744 pages.
1745 </p>
1746 <p>If you publish or distribute Opaque copies of the Document numbering
1747 more than 100, you must either include a machine-readable Transparent
1748 copy along with each Opaque copy, or state in or with each Opaque copy
1749 a computer-network location from which the general network-using
1750 public has access to download using public-standard network protocols
1751 a complete Transparent copy of the Document, free of added material.
1752 If you use the latter option, you must take reasonably prudent steps,
1753 when you begin distribution of Opaque copies in quantity, to ensure
1754 that this Transparent copy will remain thus accessible at the stated
1755 location until at least one year after the last time you distribute an
1756 Opaque copy (directly or through your agents or retailers) of that
1757 edition to the public.
1758 </p>
1759 <p>It is requested, but not required, that you contact the authors of the
1760 Document well before redistributing any large number of copies, to give
1761 them a chance to provide you with an updated version of the Document.
1762 </p>
1763 </li><li> MODIFICATIONS
1764
1765 <p>You may copy and distribute a Modified Version of the Document under
1766 the conditions of sections 2 and 3 above, provided that you release
1767 the Modified Version under precisely this License, with the Modified
1768 Version filling the role of the Document, thus licensing distribution
1769 and modification of the Modified Version to whoever possesses a copy
1770 of it.  In addition, you must do these things in the Modified Version:
1771 </p>
1772 <ol>
1773 <li> Use in the Title Page (and on the covers, if any) a title distinct
1774 from that of the Document, and from those of previous versions
1775 (which should, if there were any, be listed in the History section
1776 of the Document).  You may use the same title as a previous version
1777 if the original publisher of that version gives permission.
1778
1779 </li><li> List on the Title Page, as authors, one or more persons or entities
1780 responsible for authorship of the modifications in the Modified
1781 Version, together with at least five of the principal authors of the
1782 Document (all of its principal authors, if it has fewer than five),
1783 unless they release you from this requirement.
1784
1785 </li><li> State on the Title page the name of the publisher of the
1786 Modified Version, as the publisher.
1787
1788 </li><li> Preserve all the copyright notices of the Document.
1789
1790 </li><li> Add an appropriate copyright notice for your modifications
1791 adjacent to the other copyright notices.
1792
1793 </li><li> Include, immediately after the copyright notices, a license notice
1794 giving the public permission to use the Modified Version under the
1795 terms of this License, in the form shown in the Addendum below.
1796
1797 </li><li> Preserve in that license notice the full lists of Invariant Sections
1798 and required Cover Texts given in the Document&rsquo;s license notice.
1799
1800 </li><li> Include an unaltered copy of this License.
1801
1802 </li><li> Preserve the section Entitled &ldquo;History&rdquo;, Preserve its Title, and add
1803 to it an item stating at least the title, year, new authors, and
1804 publisher of the Modified Version as given on the Title Page.  If
1805 there is no section Entitled &ldquo;History&rdquo; in the Document, create one
1806 stating the title, year, authors, and publisher of the Document as
1807 given on its Title Page, then add an item describing the Modified
1808 Version as stated in the previous sentence.
1809
1810 </li><li> Preserve the network location, if any, given in the Document for
1811 public access to a Transparent copy of the Document, and likewise
1812 the network locations given in the Document for previous versions
1813 it was based on.  These may be placed in the &ldquo;History&rdquo; section.
1814 You may omit a network location for a work that was published at
1815 least four years before the Document itself, or if the original
1816 publisher of the version it refers to gives permission.
1817
1818 </li><li> For any section Entitled &ldquo;Acknowledgements&rdquo; or &ldquo;Dedications&rdquo;, Preserve
1819 the Title of the section, and preserve in the section all the
1820 substance and tone of each of the contributor acknowledgements and/or
1821 dedications given therein.
1822
1823 </li><li> Preserve all the Invariant Sections of the Document,
1824 unaltered in their text and in their titles.  Section numbers
1825 or the equivalent are not considered part of the section titles.
1826
1827 </li><li> Delete any section Entitled &ldquo;Endorsements&rdquo;.  Such a section
1828 may not be included in the Modified Version.
1829
1830 </li><li> Do not retitle any existing section to be Entitled &ldquo;Endorsements&rdquo; or
1831 to conflict in title with any Invariant Section.
1832
1833 </li><li> Preserve any Warranty Disclaimers.
1834 </li></ol>
1835
1836 <p>If the Modified Version includes new front-matter sections or
1837 appendices that qualify as Secondary Sections and contain no material
1838 copied from the Document, you may at your option designate some or all
1839 of these sections as invariant.  To do this, add their titles to the
1840 list of Invariant Sections in the Modified Version&rsquo;s license notice.
1841 These titles must be distinct from any other section titles.
1842 </p>
1843 <p>You may add a section Entitled &ldquo;Endorsements&rdquo;, provided it contains
1844 nothing but endorsements of your Modified Version by various
1845 parties&mdash;for example, statements of peer review or that the text has
1846 been approved by an organization as the authoritative definition of a
1847 standard.
1848 </p>
1849 <p>You may add a passage of up to five words as a Front-Cover Text, and a
1850 passage of up to 25 words as a Back-Cover Text, to the end of the list
1851 of Cover Texts in the Modified Version.  Only one passage of
1852 Front-Cover Text and one of Back-Cover Text may be added by (or
1853 through arrangements made by) any one entity.  If the Document already
1854 includes a cover text for the same cover, previously added by you or
1855 by arrangement made by the same entity you are acting on behalf of,
1856 you may not add another; but you may replace the old one, on explicit
1857 permission from the previous publisher that added the old one.
1858 </p>
1859 <p>The author(s) and publisher(s) of the Document do not by this License
1860 give permission to use their names for publicity for or to assert or
1861 imply endorsement of any Modified Version.
1862 </p>
1863 </li><li> COMBINING DOCUMENTS
1864
1865 <p>You may combine the Document with other documents released under this
1866 License, under the terms defined in section 4 above for modified
1867 versions, provided that you include in the combination all of the
1868 Invariant Sections of all of the original documents, unmodified, and
1869 list them all as Invariant Sections of your combined work in its
1870 license notice, and that you preserve all their Warranty Disclaimers.
1871 </p>
1872 <p>The combined work need only contain one copy of this License, and
1873 multiple identical Invariant Sections may be replaced with a single
1874 copy.  If there are multiple Invariant Sections with the same name but
1875 different contents, make the title of each such section unique by
1876 adding at the end of it, in parentheses, the name of the original
1877 author or publisher of that section if known, or else a unique number.
1878 Make the same adjustment to the section titles in the list of
1879 Invariant Sections in the license notice of the combined work.
1880 </p>
1881 <p>In the combination, you must combine any sections Entitled &ldquo;History&rdquo;
1882 in the various original documents, forming one section Entitled
1883 &ldquo;History&rdquo;; likewise combine any sections Entitled &ldquo;Acknowledgements&rdquo;,
1884 and any sections Entitled &ldquo;Dedications&rdquo;.  You must delete all
1885 sections Entitled &ldquo;Endorsements.&rdquo;
1886 </p>
1887 </li><li> COLLECTIONS OF DOCUMENTS
1888
1889 <p>You may make a collection consisting of the Document and other documents
1890 released under this License, and replace the individual copies of this
1891 License in the various documents with a single copy that is included in
1892 the collection, provided that you follow the rules of this License for
1893 verbatim copying of each of the documents in all other respects.
1894 </p>
1895 <p>You may extract a single document from such a collection, and distribute
1896 it individually under this License, provided you insert a copy of this
1897 License into the extracted document, and follow this License in all
1898 other respects regarding verbatim copying of that document.
1899 </p>
1900 </li><li> AGGREGATION WITH INDEPENDENT WORKS
1901
1902 <p>A compilation of the Document or its derivatives with other separate
1903 and independent documents or works, in or on a volume of a storage or
1904 distribution medium, is called an &ldquo;aggregate&rdquo; if the copyright
1905 resulting from the compilation is not used to limit the legal rights
1906 of the compilation&rsquo;s users beyond what the individual works permit.
1907 When the Document is included in an aggregate, this License does not
1908 apply to the other works in the aggregate which are not themselves
1909 derivative works of the Document.
1910 </p>
1911 <p>If the Cover Text requirement of section 3 is applicable to these
1912 copies of the Document, then if the Document is less than one half of
1913 the entire aggregate, the Document&rsquo;s Cover Texts may be placed on
1914 covers that bracket the Document within the aggregate, or the
1915 electronic equivalent of covers if the Document is in electronic form.
1916 Otherwise they must appear on printed covers that bracket the whole
1917 aggregate.
1918 </p>
1919 </li><li> TRANSLATION
1920
1921 <p>Translation is considered a kind of modification, so you may
1922 distribute translations of the Document under the terms of section 4.
1923 Replacing Invariant Sections with translations requires special
1924 permission from their copyright holders, but you may include
1925 translations of some or all Invariant Sections in addition to the
1926 original versions of these Invariant Sections.  You may include a
1927 translation of this License, and all the license notices in the
1928 Document, and any Warranty Disclaimers, provided that you also include
1929 the original English version of this License and the original versions
1930 of those notices and disclaimers.  In case of a disagreement between
1931 the translation and the original version of this License or a notice
1932 or disclaimer, the original version will prevail.
1933 </p>
1934 <p>If a section in the Document is Entitled &ldquo;Acknowledgements&rdquo;,
1935 &ldquo;Dedications&rdquo;, or &ldquo;History&rdquo;, the requirement (section 4) to Preserve
1936 its Title (section 1) will typically require changing the actual
1937 title.
1938 </p>
1939 </li><li> TERMINATION
1940
1941 <p>You may not copy, modify, sublicense, or distribute the Document
1942 except as expressly provided under this License.  Any attempt
1943 otherwise to copy, modify, sublicense, or distribute it is void, and
1944 will automatically terminate your rights under this License.
1945 </p>
1946 <p>However, if you cease all violation of this License, then your license
1947 from a particular copyright holder is reinstated (a) provisionally,
1948 unless and until the copyright holder explicitly and finally
1949 terminates your license, and (b) permanently, if the copyright holder
1950 fails to notify you of the violation by some reasonable means prior to
1951 60 days after the cessation.
1952 </p>
1953 <p>Moreover, your license from a particular copyright holder is
1954 reinstated permanently if the copyright holder notifies you of the
1955 violation by some reasonable means, this is the first time you have
1956 received notice of violation of this License (for any work) from that
1957 copyright holder, and you cure the violation prior to 30 days after
1958 your receipt of the notice.
1959 </p>
1960 <p>Termination of your rights under this section does not terminate the
1961 licenses of parties who have received copies or rights from you under
1962 this License.  If your rights have been terminated and not permanently
1963 reinstated, receipt of a copy of some or all of the same material does
1964 not give you any rights to use it.
1965 </p>
1966 </li><li> FUTURE REVISIONS OF THIS LICENSE
1967
1968 <p>The Free Software Foundation may publish new, revised versions
1969 of the GNU Free Documentation License from time to time.  Such new
1970 versions will be similar in spirit to the present version, but may
1971 differ in detail to address new problems or concerns.  See
1972 <a href="http://www.gnu.org/copyleft/">http://www.gnu.org/copyleft/</a>.
1973 </p>
1974 <p>Each version of the License is given a distinguishing version number.
1975 If the Document specifies that a particular numbered version of this
1976 License &ldquo;or any later version&rdquo; applies to it, you have the option of
1977 following the terms and conditions either of that specified version or
1978 of any later version that has been published (not as a draft) by the
1979 Free Software Foundation.  If the Document does not specify a version
1980 number of this License, you may choose any version ever published (not
1981 as a draft) by the Free Software Foundation.  If the Document
1982 specifies that a proxy can decide which future versions of this
1983 License can be used, that proxy&rsquo;s public statement of acceptance of a
1984 version permanently authorizes you to choose that version for the
1985 Document.
1986 </p>
1987 </li><li> RELICENSING
1988
1989 <p>&ldquo;Massive Multiauthor Collaboration Site&rdquo; (or &ldquo;MMC Site&rdquo;) means any
1990 World Wide Web server that publishes copyrightable works and also
1991 provides prominent facilities for anybody to edit those works.  A
1992 public wiki that anybody can edit is an example of such a server.  A
1993 &ldquo;Massive Multiauthor Collaboration&rdquo; (or &ldquo;MMC&rdquo;) contained in the
1994 site means any set of copyrightable works thus published on the MMC
1995 site.
1996 </p>
1997 <p>&ldquo;CC-BY-SA&rdquo; means the Creative Commons Attribution-Share Alike 3.0
1998 license published by Creative Commons Corporation, a not-for-profit
1999 corporation with a principal place of business in San Francisco,
2000 California, as well as future copyleft versions of that license
2001 published by that same organization.
2002 </p>
2003 <p>&ldquo;Incorporate&rdquo; means to publish or republish a Document, in whole or
2004 in part, as part of another Document.
2005 </p>
2006 <p>An MMC is &ldquo;eligible for relicensing&rdquo; if it is licensed under this
2007 License, and if all works that were first published under this License
2008 somewhere other than this MMC, and subsequently incorporated in whole
2009 or in part into the MMC, (1) had no cover texts or invariant sections,
2010 and (2) were thus incorporated prior to November 1, 2008.
2011 </p>
2012 <p>The operator of an MMC Site may republish an MMC contained in the site
2013 under CC-BY-SA on the same site at any time before August 1, 2009,
2014 provided the MMC is eligible for relicensing.
2015 </p>
2016 </li></ol>
2017
2018 <a name="ADDENDUM_003a-How-to-use-this-License-for-your-documents"></a>
2019 <h3 class="heading">ADDENDUM: How to use this License for your documents</h3>
2020
2021 <p>To use this License in a document you have written, include a copy of
2022 the License in the document and put the following copyright and
2023 license notices just after the title page:
2024 </p>
2025 <div class="example">
2026 <pre class="example">  Copyright (C)  <var>year</var>  <var>your name</var>.
2027   Permission is granted to copy, distribute and/or modify this document
2028   under the terms of the GNU Free Documentation License, Version 1.3
2029   or any later version published by the Free Software Foundation;
2030   with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
2031   Texts.  A copy of the license is included in the section entitled ``GNU
2032   Free Documentation License''.
2033 </pre></div>
2034
2035 <p>If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
2036 replace the &ldquo;with&hellip;Texts.&rdquo; line with this:
2037 </p>
2038 <div class="example">
2039 <pre class="example">    with the Invariant Sections being <var>list their titles</var>, with
2040     the Front-Cover Texts being <var>list</var>, and with the Back-Cover Texts
2041     being <var>list</var>.
2042 </pre></div>
2043
2044 <p>If you have Invariant Sections without Cover Texts, or some other
2045 combination of the three, merge those two alternatives to suit the
2046 situation.
2047 </p>
2048 <p>If your document contains nontrivial examples of program code, we
2049 recommend releasing these examples in parallel under your choice of
2050 free software license, such as the GNU General Public License,
2051 to permit their use in free software.
2052 </p>
2053
2054
2055
2056 <hr>
2057
2058
2059
2060 </body>
2061 </html>