summaryrefslogtreecommitdiffstats
path: root/doc/reference/html/gnutls-tpm.html
blob: 8a58d7aaf581bed8a53ed092ea2e99f58aed3fa9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>tpm: GnuTLS API Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="GnuTLS API Reference Manual">
<link rel="up" href="intro.html" title="GnuTLS API Reference Manual">
<link rel="prev" href="gnutls-dtls.html" title="dtls">
<link rel="next" href="api-index-full.html" title="API Index">
<meta name="generator" content="GTK-Doc V1.33.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
                  <a href="#gnutls-tpm.description" class="shortcut">Description</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="intro.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="gnutls-dtls.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="api-index-full.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="gnutls-tpm"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gnutls-tpm.top_of_page"></a>tpm</span></h2>
<p>tpm</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="gnutls-tpm.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_proto_type">
<col class="functions_proto_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-tpm.html#gnutls-tpm-privkey-generate" title="gnutls_tpm_privkey_generate ()">gnutls_tpm_privkey_generate</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-tpm.html#gnutls-tpm-key-list-deinit" title="gnutls_tpm_key_list_deinit ()">gnutls_tpm_key_list_deinit</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-tpm.html#gnutls-tpm-key-list-get-url" title="gnutls_tpm_key_list_get_url ()">gnutls_tpm_key_list_get_url</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-tpm.html#gnutls-tpm-get-registered" title="gnutls_tpm_get_registered ()">gnutls_tpm_get_registered</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-tpm.html#gnutls-tpm-privkey-delete" title="gnutls_tpm_privkey_delete ()">gnutls_tpm_privkey_delete</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="gnutls-tpm.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="other_proto_type">
<col class="other_proto_name">
</colgroup>
<tbody>
<tr>
<td class="typedef_keyword">typedef</td>
<td class="function_name"><a class="link" href="gnutls-tpm.html#gnutls-tpm-key-list-t" title="gnutls_tpm_key_list_t">gnutls_tpm_key_list_t</a></td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="gnutls-tpm.html#GNUTLS-TPM-KEY-SIGNING:CAPS" title="GNUTLS_TPM_KEY_SIGNING">GNUTLS_TPM_KEY_SIGNING</a></td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="gnutls-tpm.html#GNUTLS-TPM-REGISTER-KEY:CAPS" title="GNUTLS_TPM_REGISTER_KEY">GNUTLS_TPM_REGISTER_KEY</a></td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="gnutls-tpm.html#GNUTLS-TPM-KEY-USER:CAPS" title="GNUTLS_TPM_KEY_USER">GNUTLS_TPM_KEY_USER</a></td>
</tr>
<tr>
<td class="datatype_keyword">enum</td>
<td class="function_name"><a class="link" href="gnutls-tpm.html#gnutls-tpmkey-fmt-t" title="enum gnutls_tpmkey_fmt_t">gnutls_tpmkey_fmt_t</a></td>
</tr>
<tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="gnutls-tpm.html#tpm-key-list-st" title="struct tpm_key_list_st">tpm_key_list_st</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="gnutls-tpm.description"></a><h2>Description</h2>
</div>
<div class="refsect1">
<a name="gnutls-tpm.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="gnutls-tpm-privkey-generate"></a><h3>gnutls_tpm_privkey_generate ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
gnutls_tpm_privkey_generate (<em class="parameter"><code><a class="link" href="gnutls-gnutls.html#gnutls-pk-algorithm-t" title="enum gnutls_pk_algorithm_t"><span class="type">gnutls_pk_algorithm_t</span></a> pk</code></em>,
                             <em class="parameter"><code>unsigned <span class="type">int</span> bits</code></em>,
                             <em class="parameter"><code>const <span class="type">char</span> *srk_password</code></em>,
                             <em class="parameter"><code>const <span class="type">char</span> *key_password</code></em>,
                             <em class="parameter"><code><a class="link" href="gnutls-tpm.html#gnutls-tpmkey-fmt-t" title="enum gnutls_tpmkey_fmt_t"><span class="type">gnutls_tpmkey_fmt_t</span></a> format</code></em>,
                             <em class="parameter"><code><a class="link" href="gnutls-gnutls.html#gnutls-x509-crt-fmt-t" title="enum gnutls_x509_crt_fmt_t"><span class="type">gnutls_x509_crt_fmt_t</span></a> pub_format</code></em>,
                             <em class="parameter"><code><a class="link" href="gnutls-gnutls.html#gnutls-datum-t" title="gnutls_datum_t"><span class="type">gnutls_datum_t</span></a> *privkey</code></em>,
                             <em class="parameter"><code><a class="link" href="gnutls-gnutls.html#gnutls-datum-t" title="gnutls_datum_t"><span class="type">gnutls_datum_t</span></a> *pubkey</code></em>,
                             <em class="parameter"><code>unsigned <span class="type">int</span> flags</code></em>);</pre>
<p>This function will generate a private key in the TPM
chip. The private key will be generated within the chip
and will be exported in a wrapped with TPM's master key
form. Furthermore the wrapped key can be protected with
the provided <em class="parameter"><code>password</code></em>
.</p>
<p>Note that bits in TPM is quantized value. If the input value
is not one of the allowed values, then it will be quantized to
one of 512, 1024, 2048, 4096, 8192 and 16384.</p>
<p>Allowed flags are:</p>
<p><a class="link" href="gnutls-tpm.html#GNUTLS-TPM-KEY-SIGNING:CAPS" title="GNUTLS_TPM_KEY_SIGNING"><code class="literal">GNUTLS_TPM_KEY_SIGNING</code></a>: Generate a signing key instead of a legacy,</p>
<p><a class="link" href="gnutls-tpm.html#GNUTLS-TPM-REGISTER-KEY:CAPS" title="GNUTLS_TPM_REGISTER_KEY"><code class="literal">GNUTLS_TPM_REGISTER_KEY</code></a>: Register the generate key in TPM. In that
case <em class="parameter"><code>privkey</code></em>
 would contain a URL with the UUID.</p>
<div class="refsect3">
<a name="gnutls-tpm-privkey-generate.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>pk</p></td>
<td class="parameter_description"><p>the public key algorithm</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>bits</p></td>
<td class="parameter_description"><p>the security bits</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>srk_password</p></td>
<td class="parameter_description"><p>a password to protect the exported key (optional)</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>key_password</p></td>
<td class="parameter_description"><p>the password for the TPM (optional)</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>format</p></td>
<td class="parameter_description"><p>the format of the private key</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>pub_format</p></td>
<td class="parameter_description"><p>the format of the public key</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>privkey</p></td>
<td class="parameter_description"><p>the generated key</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>pubkey</p></td>
<td class="parameter_description"><p>the corresponding public key (may be null)</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>flags</p></td>
<td class="parameter_description"><p>should be a list of GNUTLS_TPM_* flags</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gnutls-tpm-privkey-generate.returns"></a><h4>Returns</h4>
<p> On success, <a class="link" href="gnutls-gnutls.html#GNUTLS-E-SUCCESS:CAPS" title="GNUTLS_E_SUCCESS"><code class="literal">GNUTLS_E_SUCCESS</code></a> (0) is returned, otherwise a
negative error value.</p>
</div>
<p class="since">Since: 3.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-tpm-key-list-deinit"></a><h3>gnutls_tpm_key_list_deinit ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gnutls_tpm_key_list_deinit (<em class="parameter"><code><a class="link" href="gnutls-tpm.html#gnutls-tpm-key-list-t" title="gnutls_tpm_key_list_t"><span class="type">gnutls_tpm_key_list_t</span></a> list</code></em>);</pre>
<p>This function will deinitialize the list of stored keys in the TPM.</p>
<div class="refsect3">
<a name="gnutls-tpm-key-list-deinit.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>list</p></td>
<td class="parameter_description"><p>a list of the keys</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: 3.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-tpm-key-list-get-url"></a><h3>gnutls_tpm_key_list_get_url ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
gnutls_tpm_key_list_get_url (<em class="parameter"><code><a class="link" href="gnutls-tpm.html#gnutls-tpm-key-list-t" title="gnutls_tpm_key_list_t"><span class="type">gnutls_tpm_key_list_t</span></a> list</code></em>,
                             <em class="parameter"><code>unsigned <span class="type">int</span> idx</code></em>,
                             <em class="parameter"><code><span class="type">char</span> **url</code></em>,
                             <em class="parameter"><code>unsigned <span class="type">int</span> flags</code></em>);</pre>
<p>This function will return for each given index a URL of
the corresponding key.
If the provided index is out of bounds then <a class="link" href="gnutls-gnutls.html#GNUTLS-E-REQUESTED-DATA-NOT-AVAILABLE:CAPS" title="GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE"><code class="literal">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code></a>
is returned.</p>
<div class="refsect3">
<a name="gnutls-tpm-key-list-get-url.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>list</p></td>
<td class="parameter_description"><p>a list of the keys</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>idx</p></td>
<td class="parameter_description"><p>The index of the key (starting from zero)</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>url</p></td>
<td class="parameter_description"><p>The URL to be returned</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>flags</p></td>
<td class="parameter_description"><p>should be zero</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gnutls-tpm-key-list-get-url.returns"></a><h4>Returns</h4>
<p> On success, <a class="link" href="gnutls-gnutls.html#GNUTLS-E-SUCCESS:CAPS" title="GNUTLS_E_SUCCESS"><code class="literal">GNUTLS_E_SUCCESS</code></a> (0) is returned, otherwise a
negative error value.</p>
</div>
<p class="since">Since: 3.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-tpm-get-registered"></a><h3>gnutls_tpm_get_registered ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
gnutls_tpm_get_registered (<em class="parameter"><code><a class="link" href="gnutls-tpm.html#gnutls-tpm-key-list-t" title="gnutls_tpm_key_list_t"><span class="type">gnutls_tpm_key_list_t</span></a> *list</code></em>);</pre>
<p>This function will get a list of stored keys in the TPM. The uuid
of those keys</p>
<div class="refsect3">
<a name="gnutls-tpm-get-registered.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>list</p></td>
<td class="parameter_description"><p>a list to store the keys</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gnutls-tpm-get-registered.returns"></a><h4>Returns</h4>
<p> On success, <a class="link" href="gnutls-gnutls.html#GNUTLS-E-SUCCESS:CAPS" title="GNUTLS_E_SUCCESS"><code class="literal">GNUTLS_E_SUCCESS</code></a> (0) is returned, otherwise a
negative error value.</p>
</div>
<p class="since">Since: 3.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-tpm-privkey-delete"></a><h3>gnutls_tpm_privkey_delete ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
gnutls_tpm_privkey_delete (<em class="parameter"><code>const <span class="type">char</span> *url</code></em>,
                           <em class="parameter"><code>const <span class="type">char</span> *srk_password</code></em>);</pre>
<p>This function will unregister the private key from the TPM
chip.</p>
<div class="refsect3">
<a name="gnutls-tpm-privkey-delete.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>url</p></td>
<td class="parameter_description"><p>the URL describing the key</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>srk_password</p></td>
<td class="parameter_description"><p>a password for the SRK key</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gnutls-tpm-privkey-delete.returns"></a><h4>Returns</h4>
<p> On success, <a class="link" href="gnutls-gnutls.html#GNUTLS-E-SUCCESS:CAPS" title="GNUTLS_E_SUCCESS"><code class="literal">GNUTLS_E_SUCCESS</code></a> (0) is returned, otherwise a
negative error value.</p>
</div>
<p class="since">Since: 3.1.0</p>
</div>
</div>
<div class="refsect1">
<a name="gnutls-tpm.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="gnutls-tpm-key-list-t"></a><h3>gnutls_tpm_key_list_t</h3>
<pre class="programlisting">typedef struct tpm_key_list_st *gnutls_tpm_key_list_t;
</pre>
</div>
<hr>
<div class="refsect2">
<a name="GNUTLS-TPM-KEY-SIGNING:CAPS"></a><h3>GNUTLS_TPM_KEY_SIGNING</h3>
<pre class="programlisting">#define GNUTLS_TPM_KEY_SIGNING (1&lt;&lt;1)
</pre>
</div>
<hr>
<div class="refsect2">
<a name="GNUTLS-TPM-REGISTER-KEY:CAPS"></a><h3>GNUTLS_TPM_REGISTER_KEY</h3>
<pre class="programlisting">#define GNUTLS_TPM_REGISTER_KEY (1&lt;&lt;2)
</pre>
</div>
<hr>
<div class="refsect2">
<a name="GNUTLS-TPM-KEY-USER:CAPS"></a><h3>GNUTLS_TPM_KEY_USER</h3>
<pre class="programlisting">#define GNUTLS_TPM_KEY_USER (1&lt;&lt;3)
</pre>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-tpmkey-fmt-t"></a><h3>enum gnutls_tpmkey_fmt_t</h3>
<p>Enumeration of different certificate encoding formats.</p>
<div class="refsect3">
<a name="gnutls-tpmkey-fmt-t.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="enum_members_name">
<col class="enum_members_description">
<col width="200px" class="enum_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="enum_member_name"><p><a name="GNUTLS-TPMKEY-FMT-RAW:CAPS"></a>GNUTLS_TPMKEY_FMT_RAW</p></td>
<td class="enum_member_description">
<p>The portable data format.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="GNUTLS-TPMKEY-FMT-DER:CAPS"></a>GNUTLS_TPMKEY_FMT_DER</p></td>
<td class="enum_member_description">
<p>An alias for the raw format.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="GNUTLS-TPMKEY-FMT-CTK-PEM:CAPS"></a>GNUTLS_TPMKEY_FMT_CTK_PEM</p></td>
<td class="enum_member_description">
<p>A custom data format used by some TPM tools.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="tpm-key-list-st"></a><h3>struct tpm_key_list_st</h3>
<pre class="programlisting">struct tpm_key_list_st;</pre>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.33.1</div>
</body>
</html>