Debian Codegraph @

doc/reference/html/gnutls-pkcs12.html

raw
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>pkcs12: GnuTLS API Reference Manual</title>
6 <meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
7 <link rel="home" href="index.html" title="GnuTLS API Reference Manual">
8 <link rel="up" href="intro.html" title="GnuTLS API Reference Manual">
9 <link rel="prev" href="gnutls-pkcs11.html" title="pkcs11">
10 <link rel="next" href="gnutls-ocsp.html" title="ocsp">
11 <meta name="generator" content="GTK-Doc V1.34.0 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 </head>
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
16 <td width="100%" align="left" class="shortcuts">
17 <a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
18 <a href="#gnutls-pkcs12.description" class="shortcut">Description</a></span>
19 </td>
20 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
21 <td><a accesskey="u" href="intro.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
22 <td><a accesskey="p" href="gnutls-pkcs11.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
23 <td><a accesskey="n" href="gnutls-ocsp.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
24 </tr></table>
25 <div class="refentry">
26 <a name="gnutls-pkcs12"></a><div class="titlepage"></div>
27 <div class="refnamediv"><table width="100%"><tr>
28 <td valign="top">
29 <h2><span class="refentrytitle"><a name="gnutls-pkcs12.top_of_page"></a>pkcs12</span></h2>
30 <p>pkcs12</p>
31 </td>
32 <td class="gallery_image" valign="top" align="right"></td>
33 </tr></table></div>
34 <div class="refsect1">
35 <a name="gnutls-pkcs12.functions"></a><h2>Functions</h2>
36 <div class="informaltable"><table class="informaltable" width="100%" border="0">
37 <colgroup>
38 <col width="150px" class="functions_proto_type">
39 <col class="functions_proto_name">
40 </colgroup>
41 <tbody>
42 <tr>
43 <td class="function_type">
44 <span class="returnvalue">int</span>
45 </td>
46 <td class="function_name">
47 <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-init" title="gnutls_pkcs12_init ()">gnutls_pkcs12_init</a> <span class="c_punctuation">()</span>
48 </td>
49 </tr>
50 <tr>
51 <td class="function_type">
52 <span class="returnvalue">void</span>
53 </td>
54 <td class="function_name">
55 <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-deinit" title="gnutls_pkcs12_deinit ()">gnutls_pkcs12_deinit</a> <span class="c_punctuation">()</span>
56 </td>
57 </tr>
58 <tr>
59 <td class="function_type">
60 <span class="returnvalue">int</span>
61 </td>
62 <td class="function_name">
63 <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-import" title="gnutls_pkcs12_import ()">gnutls_pkcs12_import</a> <span class="c_punctuation">()</span>
64 </td>
65 </tr>
66 <tr>
67 <td class="function_type">
68 <span class="returnvalue">int</span>
69 </td>
70 <td class="function_name">
71 <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-export" title="gnutls_pkcs12_export ()">gnutls_pkcs12_export</a> <span class="c_punctuation">()</span>
72 </td>
73 </tr>
74 <tr>
75 <td class="function_type">
76 <span class="returnvalue">int</span>
77 </td>
78 <td class="function_name">
79 <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-export2" title="gnutls_pkcs12_export2 ()">gnutls_pkcs12_export2</a> <span class="c_punctuation">()</span>
80 </td>
81 </tr>
82 <tr>
83 <td class="function_type">
84 <span class="returnvalue">int</span>
85 </td>
86 <td class="function_name">
87 <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-get-bag" title="gnutls_pkcs12_get_bag ()">gnutls_pkcs12_get_bag</a> <span class="c_punctuation">()</span>
88 </td>
89 </tr>
90 <tr>
91 <td class="function_type">
92 <span class="returnvalue">int</span>
93 </td>
94 <td class="function_name">
95 <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-set-bag" title="gnutls_pkcs12_set_bag ()">gnutls_pkcs12_set_bag</a> <span class="c_punctuation">()</span>
96 </td>
97 </tr>
98 <tr>
99 <td class="function_type">
100 <span class="returnvalue">int</span>
101 </td>
102 <td class="function_name">
103 <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-generate-mac" title="gnutls_pkcs12_generate_mac ()">gnutls_pkcs12_generate_mac</a> <span class="c_punctuation">()</span>
104 </td>
105 </tr>
106 <tr>
107 <td class="function_type">
108 <span class="returnvalue">int</span>
109 </td>
110 <td class="function_name">
111 <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-generate-mac2" title="gnutls_pkcs12_generate_mac2 ()">gnutls_pkcs12_generate_mac2</a> <span class="c_punctuation">()</span>
112 </td>
113 </tr>
114 <tr>
115 <td class="function_type">
116 <span class="returnvalue">int</span>
117 </td>
118 <td class="function_name">
119 <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-generate-mac3" title="gnutls_pkcs12_generate_mac3 ()">gnutls_pkcs12_generate_mac3</a> <span class="c_punctuation">()</span>
120 </td>
121 </tr>
122 <tr>
123 <td class="function_type">
124 <span class="returnvalue">int</span>
125 </td>
126 <td class="function_name">
127 <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-verify-mac" title="gnutls_pkcs12_verify_mac ()">gnutls_pkcs12_verify_mac</a> <span class="c_punctuation">()</span>
128 </td>
129 </tr>
130 <tr>
131 <td class="function_type">
132 <span class="returnvalue">int</span>
133 </td>
134 <td class="function_name">
135 <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-decrypt" title="gnutls_pkcs12_bag_decrypt ()">gnutls_pkcs12_bag_decrypt</a> <span class="c_punctuation">()</span>
136 </td>
137 </tr>
138 <tr>
139 <td class="function_type">
140 <span class="returnvalue">int</span>
141 </td>
142 <td class="function_name">
143 <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-encrypt" title="gnutls_pkcs12_bag_encrypt ()">gnutls_pkcs12_bag_encrypt</a> <span class="c_punctuation">()</span>
144 </td>
145 </tr>
146 <tr>
147 <td class="function_type">
148 <span class="returnvalue">int</span>
149 </td>
150 <td class="function_name">
151 <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-enc-info" title="gnutls_pkcs12_bag_enc_info ()">gnutls_pkcs12_bag_enc_info</a> <span class="c_punctuation">()</span>
152 </td>
153 </tr>
154 <tr>
155 <td class="function_type">
156 <span class="returnvalue">int</span>
157 </td>
158 <td class="function_name">
159 <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-mac-info" title="gnutls_pkcs12_mac_info ()">gnutls_pkcs12_mac_info</a> <span class="c_punctuation">()</span>
160 </td>
161 </tr>
162 <tr>
163 <td class="function_type">
164 <span class="returnvalue">int</span>
165 </td>
166 <td class="function_name">
167 <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-simple-parse" title="gnutls_pkcs12_simple_parse ()">gnutls_pkcs12_simple_parse</a> <span class="c_punctuation">()</span>
168 </td>
169 </tr>
170 <tr>
171 <td class="function_type">
172 <span class="returnvalue">int</span>
173 </td>
174 <td class="function_name">
175 <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-get-data" title="gnutls_pkcs12_bag_get_data ()">gnutls_pkcs12_bag_get_data</a> <span class="c_punctuation">()</span>
176 </td>
177 </tr>
178 <tr>
179 <td class="function_type">
180 <span class="returnvalue">int</span>
181 </td>
182 <td class="function_name">
183 <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-set-data" title="gnutls_pkcs12_bag_set_data ()">gnutls_pkcs12_bag_set_data</a> <span class="c_punctuation">()</span>
184 </td>
185 </tr>
186 <tr>
187 <td class="function_type">
188 <span class="returnvalue">int</span>
189 </td>
190 <td class="function_name">
191 <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-set-crl" title="gnutls_pkcs12_bag_set_crl ()">gnutls_pkcs12_bag_set_crl</a> <span class="c_punctuation">()</span>
192 </td>
193 </tr>
194 <tr>
195 <td class="function_type">
196 <span class="returnvalue">int</span>
197 </td>
198 <td class="function_name">
199 <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-set-crt" title="gnutls_pkcs12_bag_set_crt ()">gnutls_pkcs12_bag_set_crt</a> <span class="c_punctuation">()</span>
200 </td>
201 </tr>
202 <tr>
203 <td class="function_type">
204 <span class="returnvalue">int</span>
205 </td>
206 <td class="function_name">
207 <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-set-privkey" title="gnutls_pkcs12_bag_set_privkey ()">gnutls_pkcs12_bag_set_privkey</a> <span class="c_punctuation">()</span>
208 </td>
209 </tr>
210 <tr>
211 <td class="function_type">
212 <span class="returnvalue">int</span>
213 </td>
214 <td class="function_name">
215 <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-init" title="gnutls_pkcs12_bag_init ()">gnutls_pkcs12_bag_init</a> <span class="c_punctuation">()</span>
216 </td>
217 </tr>
218 <tr>
219 <td class="function_type">
220 <span class="returnvalue">void</span>
221 </td>
222 <td class="function_name">
223 <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-deinit" title="gnutls_pkcs12_bag_deinit ()">gnutls_pkcs12_bag_deinit</a> <span class="c_punctuation">()</span>
224 </td>
225 </tr>
226 <tr>
227 <td class="function_type">
228 <span class="returnvalue">int</span>
229 </td>
230 <td class="function_name">
231 <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-get-count" title="gnutls_pkcs12_bag_get_count ()">gnutls_pkcs12_bag_get_count</a> <span class="c_punctuation">()</span>
232 </td>
233 </tr>
234 <tr>
235 <td class="function_type">
236 <span class="returnvalue">int</span>
237 </td>
238 <td class="function_name">
239 <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-get-key-id" title="gnutls_pkcs12_bag_get_key_id ()">gnutls_pkcs12_bag_get_key_id</a> <span class="c_punctuation">()</span>
240 </td>
241 </tr>
242 <tr>
243 <td class="function_type">
244 <span class="returnvalue">int</span>
245 </td>
246 <td class="function_name">
247 <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-set-key-id" title="gnutls_pkcs12_bag_set_key_id ()">gnutls_pkcs12_bag_set_key_id</a> <span class="c_punctuation">()</span>
248 </td>
249 </tr>
250 <tr>
251 <td class="function_type">
252 <span class="returnvalue">int</span>
253 </td>
254 <td class="function_name">
255 <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-get-friendly-name" title="gnutls_pkcs12_bag_get_friendly_name ()">gnutls_pkcs12_bag_get_friendly_name</a> <span class="c_punctuation">()</span>
256 </td>
257 </tr>
258 <tr>
259 <td class="function_type">
260 <span class="returnvalue">int</span>
261 </td>
262 <td class="function_name">
263 <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-set-friendly-name" title="gnutls_pkcs12_bag_set_friendly_name ()">gnutls_pkcs12_bag_set_friendly_name</a> <span class="c_punctuation">()</span>
264 </td>
265 </tr>
266 </tbody>
267 </table></div>
268 </div>
269 <div class="refsect1">
270 <a name="gnutls-pkcs12.other"></a><h2>Types and Values</h2>
271 <div class="informaltable"><table class="informaltable" width="100%" border="0">
272 <colgroup>
273 <col width="150px" class="other_proto_type">
274 <col class="other_proto_name">
275 </colgroup>
276 <tbody>
277 <tr>
278 <td class="typedef_keyword">typedef</td>
279 <td class="function_name"><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-t" title="gnutls_pkcs12_t">gnutls_pkcs12_t</a></td>
280 </tr>
281 <tr>
282 <td class="typedef_keyword">typedef</td>
283 <td class="function_name"><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t">gnutls_pkcs12_bag_t</a></td>
284 </tr>
285 <tr>
286 <td class="datatype_keyword">enum</td>
287 <td class="function_name"><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-flags-t" title="enum gnutls_pkcs12_flags_t">gnutls_pkcs12_flags_t</a></td>
288 </tr>
289 <tr>
290 <td class="define_keyword">#define</td>
291 <td class="function_name"><a class="link" href="gnutls-pkcs12.html#GNUTLS-PKCS12-SP-INCLUDE-SELF-SIGNED:CAPS" title="GNUTLS_PKCS12_SP_INCLUDE_SELF_SIGNED">GNUTLS_PKCS12_SP_INCLUDE_SELF_SIGNED</a></td>
292 </tr>
293 <tr>
294 <td class="datatype_keyword">enum</td>
295 <td class="function_name"><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-type-t" title="enum gnutls_pkcs12_bag_type_t">gnutls_pkcs12_bag_type_t</a></td>
296 </tr>
297 <tr>
298 <td class="datatype_keyword"> </td>
299 <td class="function_name"><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-int" title="gnutls_pkcs12_bag_int">gnutls_pkcs12_bag_int</a></td>
300 </tr>
301 <tr>
302 <td class="datatype_keyword"> </td>
303 <td class="function_name"><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-int" title="gnutls_pkcs12_int">gnutls_pkcs12_int</a></td>
304 </tr>
305 </tbody>
306 </table></div>
307 </div>
308 <div class="refsect1">
309 <a name="gnutls-pkcs12.description"></a><h2>Description</h2>
310 </div>
311 <div class="refsect1">
312 <a name="gnutls-pkcs12.functions_details"></a><h2>Functions</h2>
313 <div class="refsect2">
314 <a name="gnutls-pkcs12-init"></a><h3>gnutls_pkcs12_init ()</h3>
315 <pre class="programlisting"><span class="returnvalue">int</span>
316 gnutls_pkcs12_init (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-t" title="gnutls_pkcs12_t"><span class="type">gnutls_pkcs12_t</span></a> *pkcs12</code></em>);</pre>
317 <p>This function will initialize a PKCS12 type. PKCS12 structures
318 usually contain lists of X.509 Certificates and X.509 Certificate
319 revocation lists.</p>
320 <div class="refsect3">
321 <a name="gnutls-pkcs12-init.parameters"></a><h4>Parameters</h4>
322 <div class="informaltable"><table class="informaltable" width="100%" border="0">
323 <colgroup>
324 <col width="150px" class="parameters_name">
325 <col class="parameters_description">
326 <col width="200px" class="parameters_annotations">
327 </colgroup>
328 <tbody><tr>
329 <td class="parameter_name"><p>pkcs12</p></td>
330 <td class="parameter_description"><p>A pointer to the type to be initialized</p></td>
331 <td class="parameter_annotations"> </td>
332 </tr></tbody>
333 </table></div>
334 </div>
335 <div class="refsect3">
336 <a name="gnutls-pkcs12-init.returns"></a><h4>Returns</h4>
337 <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
338 negative error value.</p>
339 </div>
340 </div>
341 <hr>
342 <div class="refsect2">
343 <a name="gnutls-pkcs12-deinit"></a><h3>gnutls_pkcs12_deinit ()</h3>
344 <pre class="programlisting"><span class="returnvalue">void</span>
345 gnutls_pkcs12_deinit (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-t" title="gnutls_pkcs12_t"><span class="type">gnutls_pkcs12_t</span></a> pkcs12</code></em>);</pre>
346 <p>This function will deinitialize a PKCS12 type.</p>
347 <div class="refsect3">
348 <a name="gnutls-pkcs12-deinit.parameters"></a><h4>Parameters</h4>
349 <div class="informaltable"><table class="informaltable" width="100%" border="0">
350 <colgroup>
351 <col width="150px" class="parameters_name">
352 <col class="parameters_description">
353 <col width="200px" class="parameters_annotations">
354 </colgroup>
355 <tbody><tr>
356 <td class="parameter_name"><p>pkcs12</p></td>
357 <td class="parameter_description"><p>The type to be initialized</p></td>
358 <td class="parameter_annotations"> </td>
359 </tr></tbody>
360 </table></div>
361 </div>
362 </div>
363 <hr>
364 <div class="refsect2">
365 <a name="gnutls-pkcs12-import"></a><h3>gnutls_pkcs12_import ()</h3>
366 <pre class="programlisting"><span class="returnvalue">int</span>
367 gnutls_pkcs12_import (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-t" title="gnutls_pkcs12_t"><span class="type">gnutls_pkcs12_t</span></a> pkcs12</code></em>,
368 <em class="parameter"><code>const <a class="link" href="gnutls-gnutls.html#gnutls-datum-t" title="gnutls_datum_t"><span class="type">gnutls_datum_t</span></a> *data</code></em>,
369 <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> format</code></em>,
370 <em class="parameter"><code>unsigned <span class="type">int</span> flags</code></em>);</pre>
371 <p>This function will convert the given DER or PEM encoded PKCS12
372 to the native gnutls_pkcs12_t format. The output will be stored in 'pkcs12'.</p>
373 <p>If the PKCS12 is PEM encoded it should have a header of "PKCS12".</p>
374 <div class="refsect3">
375 <a name="gnutls-pkcs12-import.parameters"></a><h4>Parameters</h4>
376 <div class="informaltable"><table class="informaltable" width="100%" border="0">
377 <colgroup>
378 <col width="150px" class="parameters_name">
379 <col class="parameters_description">
380 <col width="200px" class="parameters_annotations">
381 </colgroup>
382 <tbody>
383 <tr>
384 <td class="parameter_name"><p>pkcs12</p></td>
385 <td class="parameter_description"><p>The data to store the parsed PKCS12.</p></td>
386 <td class="parameter_annotations"> </td>
387 </tr>
388 <tr>
389 <td class="parameter_name"><p>data</p></td>
390 <td class="parameter_description"><p>The DER or PEM encoded PKCS12.</p></td>
391 <td class="parameter_annotations"> </td>
392 </tr>
393 <tr>
394 <td class="parameter_name"><p>format</p></td>
395 <td class="parameter_description"><p>One of DER or PEM</p></td>
396 <td class="parameter_annotations"> </td>
397 </tr>
398 <tr>
399 <td class="parameter_name"><p>flags</p></td>
400 <td class="parameter_description"><p>an ORed sequence of gnutls_privkey_pkcs8_flags</p></td>
401 <td class="parameter_annotations"> </td>
402 </tr>
403 </tbody>
404 </table></div>
405 </div>
406 <div class="refsect3">
407 <a name="gnutls-pkcs12-import.returns"></a><h4>Returns</h4>
408 <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
409 negative error value.</p>
410 </div>
411 </div>
412 <hr>
413 <div class="refsect2">
414 <a name="gnutls-pkcs12-export"></a><h3>gnutls_pkcs12_export ()</h3>
415 <pre class="programlisting"><span class="returnvalue">int</span>
416 gnutls_pkcs12_export (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-t" title="gnutls_pkcs12_t"><span class="type">gnutls_pkcs12_t</span></a> pkcs12</code></em>,
417 <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> format</code></em>,
418 <em class="parameter"><code><span class="type">void</span> *output_data</code></em>,
419 <em class="parameter"><code><span class="type">size_t</span> *output_data_size</code></em>);</pre>
420 <p>This function will export the pkcs12 structure to DER or PEM format.</p>
421 <p>If the buffer provided is not long enough to hold the output, then
422 *output_data_size will be updated and GNUTLS_E_SHORT_MEMORY_BUFFER
423 will be returned.</p>
424 <p>If the structure is PEM encoded, it will have a header
425 of "BEGIN PKCS12".</p>
426 <div class="refsect3">
427 <a name="gnutls-pkcs12-export.parameters"></a><h4>Parameters</h4>
428 <div class="informaltable"><table class="informaltable" width="100%" border="0">
429 <colgroup>
430 <col width="150px" class="parameters_name">
431 <col class="parameters_description">
432 <col width="200px" class="parameters_annotations">
433 </colgroup>
434 <tbody>
435 <tr>
436 <td class="parameter_name"><p>pkcs12</p></td>
437 <td class="parameter_description"><p>A pkcs12 type</p></td>
438 <td class="parameter_annotations"> </td>
439 </tr>
440 <tr>
441 <td class="parameter_name"><p>format</p></td>
442 <td class="parameter_description"><p>the format of output params. One of PEM or DER.</p></td>
443 <td class="parameter_annotations"> </td>
444 </tr>
445 <tr>
446 <td class="parameter_name"><p>output_data</p></td>
447 <td class="parameter_description"><p>will contain a structure PEM or DER encoded</p></td>
448 <td class="parameter_annotations"> </td>
449 </tr>
450 <tr>
451 <td class="parameter_name"><p>output_data_size</p></td>
452 <td class="parameter_description"><p>holds the size of output_data (and will be
453 replaced by the actual size of parameters)</p></td>
454 <td class="parameter_annotations"> </td>
455 </tr>
456 </tbody>
457 </table></div>
458 </div>
459 <div class="refsect3">
460 <a name="gnutls-pkcs12-export.returns"></a><h4>Returns</h4>
461 <p> In case of failure a negative error code will be
462 returned, and 0 on success.</p>
463 </div>
464 </div>
465 <hr>
466 <div class="refsect2">
467 <a name="gnutls-pkcs12-export2"></a><h3>gnutls_pkcs12_export2 ()</h3>
468 <pre class="programlisting"><span class="returnvalue">int</span>
469 gnutls_pkcs12_export2 (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-t" title="gnutls_pkcs12_t"><span class="type">gnutls_pkcs12_t</span></a> pkcs12</code></em>,
470 <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> format</code></em>,
471 <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> *out</code></em>);</pre>
472 <p>This function will export the pkcs12 structure to DER or PEM format.</p>
473 <p>The output buffer is allocated using <code class="function">gnutls_malloc()</code>.</p>
474 <p>If the structure is PEM encoded, it will have a header
475 of "BEGIN PKCS12".</p>
476 <div class="refsect3">
477 <a name="gnutls-pkcs12-export2.parameters"></a><h4>Parameters</h4>
478 <div class="informaltable"><table class="informaltable" width="100%" border="0">
479 <colgroup>
480 <col width="150px" class="parameters_name">
481 <col class="parameters_description">
482 <col width="200px" class="parameters_annotations">
483 </colgroup>
484 <tbody>
485 <tr>
486 <td class="parameter_name"><p>pkcs12</p></td>
487 <td class="parameter_description"><p>A pkcs12 type</p></td>
488 <td class="parameter_annotations"> </td>
489 </tr>
490 <tr>
491 <td class="parameter_name"><p>format</p></td>
492 <td class="parameter_description"><p>the format of output params. One of PEM or DER.</p></td>
493 <td class="parameter_annotations"> </td>
494 </tr>
495 <tr>
496 <td class="parameter_name"><p>out</p></td>
497 <td class="parameter_description"><p>will contain a structure PEM or DER encoded</p></td>
498 <td class="parameter_annotations"> </td>
499 </tr>
500 </tbody>
501 </table></div>
502 </div>
503 <div class="refsect3">
504 <a name="gnutls-pkcs12-export2.returns"></a><h4>Returns</h4>
505 <p> In case of failure a negative error code will be
506 returned, and 0 on success.</p>
507 </div>
508 <p class="since">Since: 3.1.3</p>
509 </div>
510 <hr>
511 <div class="refsect2">
512 <a name="gnutls-pkcs12-get-bag"></a><h3>gnutls_pkcs12_get_bag ()</h3>
513 <pre class="programlisting"><span class="returnvalue">int</span>
514 gnutls_pkcs12_get_bag (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-t" title="gnutls_pkcs12_t"><span class="type">gnutls_pkcs12_t</span></a> pkcs12</code></em>,
515 <em class="parameter"><code><span class="type">int</span> indx</code></em>,
516 <em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>);</pre>
517 <p>This function will return a Bag from the PKCS12 structure.</p>
518 <p>After the last Bag has been read
519 <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> will be returned.</p>
520 <div class="refsect3">
521 <a name="gnutls-pkcs12-get-bag.parameters"></a><h4>Parameters</h4>
522 <div class="informaltable"><table class="informaltable" width="100%" border="0">
523 <colgroup>
524 <col width="150px" class="parameters_name">
525 <col class="parameters_description">
526 <col width="200px" class="parameters_annotations">
527 </colgroup>
528 <tbody>
529 <tr>
530 <td class="parameter_name"><p>pkcs12</p></td>
531 <td class="parameter_description"><p>A pkcs12 type</p></td>
532 <td class="parameter_annotations"> </td>
533 </tr>
534 <tr>
535 <td class="parameter_name"><p>indx</p></td>
536 <td class="parameter_description"><p>contains the index of the bag to extract</p></td>
537 <td class="parameter_annotations"> </td>
538 </tr>
539 <tr>
540 <td class="parameter_name"><p>bag</p></td>
541 <td class="parameter_description"><p>An initialized bag, where the contents of the bag will be copied</p></td>
542 <td class="parameter_annotations"> </td>
543 </tr>
544 </tbody>
545 </table></div>
546 </div>
547 <div class="refsect3">
548 <a name="gnutls-pkcs12-get-bag.returns"></a><h4>Returns</h4>
549 <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
550 negative error value.</p>
551 </div>
552 </div>
553 <hr>
554 <div class="refsect2">
555 <a name="gnutls-pkcs12-set-bag"></a><h3>gnutls_pkcs12_set_bag ()</h3>
556 <pre class="programlisting"><span class="returnvalue">int</span>
557 gnutls_pkcs12_set_bag (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-t" title="gnutls_pkcs12_t"><span class="type">gnutls_pkcs12_t</span></a> pkcs12</code></em>,
558 <em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>);</pre>
559 <p>This function will insert a Bag into the PKCS12 structure.</p>
560 <div class="refsect3">
561 <a name="gnutls-pkcs12-set-bag.parameters"></a><h4>Parameters</h4>
562 <div class="informaltable"><table class="informaltable" width="100%" border="0">
563 <colgroup>
564 <col width="150px" class="parameters_name">
565 <col class="parameters_description">
566 <col width="200px" class="parameters_annotations">
567 </colgroup>
568 <tbody>
569 <tr>
570 <td class="parameter_name"><p>pkcs12</p></td>
571 <td class="parameter_description"><p>should contain a gnutls_pkcs12_t type</p></td>
572 <td class="parameter_annotations"> </td>
573 </tr>
574 <tr>
575 <td class="parameter_name"><p>bag</p></td>
576 <td class="parameter_description"><p>An initialized bag</p></td>
577 <td class="parameter_annotations"> </td>
578 </tr>
579 </tbody>
580 </table></div>
581 </div>
582 <div class="refsect3">
583 <a name="gnutls-pkcs12-set-bag.returns"></a><h4>Returns</h4>
584 <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
585 negative error value.</p>
586 </div>
587 </div>
588 <hr>
589 <div class="refsect2">
590 <a name="gnutls-pkcs12-generate-mac"></a><h3>gnutls_pkcs12_generate_mac ()</h3>
591 <pre class="programlisting"><span class="returnvalue">int</span>
592 gnutls_pkcs12_generate_mac (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-t" title="gnutls_pkcs12_t"><span class="type">gnutls_pkcs12_t</span></a> pkcs12</code></em>,
593 <em class="parameter"><code>const <span class="type">char</span> *pass</code></em>);</pre>
594 <p>This function will generate a MAC for the PKCS12 structure.</p>
595 <div class="refsect3">
596 <a name="gnutls-pkcs12-generate-mac.parameters"></a><h4>Parameters</h4>
597 <div class="informaltable"><table class="informaltable" width="100%" border="0">
598 <colgroup>
599 <col width="150px" class="parameters_name">
600 <col class="parameters_description">
601 <col width="200px" class="parameters_annotations">
602 </colgroup>
603 <tbody>
604 <tr>
605 <td class="parameter_name"><p>pkcs12</p></td>
606 <td class="parameter_description"><p>A pkcs12 type</p></td>
607 <td class="parameter_annotations"> </td>
608 </tr>
609 <tr>
610 <td class="parameter_name"><p>pass</p></td>
611 <td class="parameter_description"><p>The password for the MAC</p></td>
612 <td class="parameter_annotations"> </td>
613 </tr>
614 </tbody>
615 </table></div>
616 </div>
617 <div class="refsect3">
618 <a name="gnutls-pkcs12-generate-mac.returns"></a><h4>Returns</h4>
619 <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
620 negative error value.</p>
621 </div>
622 </div>
623 <hr>
624 <div class="refsect2">
625 <a name="gnutls-pkcs12-generate-mac2"></a><h3>gnutls_pkcs12_generate_mac2 ()</h3>
626 <pre class="programlisting"><span class="returnvalue">int</span>
627 gnutls_pkcs12_generate_mac2 (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-t" title="gnutls_pkcs12_t"><span class="type">gnutls_pkcs12_t</span></a> pkcs12</code></em>,
628 <em class="parameter"><code><a class="link" href="gnutls-gnutls.html#gnutls-mac-algorithm-t" title="enum gnutls_mac_algorithm_t"><span class="type">gnutls_mac_algorithm_t</span></a> mac</code></em>,
629 <em class="parameter"><code>const <span class="type">char</span> *pass</code></em>);</pre>
630 <p>This function will generate a MAC for the PKCS12 structure.</p>
631 <div class="refsect3">
632 <a name="gnutls-pkcs12-generate-mac2.parameters"></a><h4>Parameters</h4>
633 <div class="informaltable"><table class="informaltable" width="100%" border="0">
634 <colgroup>
635 <col width="150px" class="parameters_name">
636 <col class="parameters_description">
637 <col width="200px" class="parameters_annotations">
638 </colgroup>
639 <tbody>
640 <tr>
641 <td class="parameter_name"><p>pkcs12</p></td>
642 <td class="parameter_description"><p>A pkcs12 type</p></td>
643 <td class="parameter_annotations"> </td>
644 </tr>
645 <tr>
646 <td class="parameter_name"><p>mac</p></td>
647 <td class="parameter_description"><p>the MAC algorithm to use</p></td>
648 <td class="parameter_annotations"> </td>
649 </tr>
650 <tr>
651 <td class="parameter_name"><p>pass</p></td>
652 <td class="parameter_description"><p>The password for the MAC</p></td>
653 <td class="parameter_annotations"> </td>
654 </tr>
655 </tbody>
656 </table></div>
657 </div>
658 <div class="refsect3">
659 <a name="gnutls-pkcs12-generate-mac2.returns"></a><h4>Returns</h4>
660 <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
661 negative error value.</p>
662 </div>
663 </div>
664 <hr>
665 <div class="refsect2">
666 <a name="gnutls-pkcs12-generate-mac3"></a><h3>gnutls_pkcs12_generate_mac3 ()</h3>
667 <pre class="programlisting"><span class="returnvalue">int</span>
668 gnutls_pkcs12_generate_mac3 (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-t" title="gnutls_pkcs12_t"><span class="type">gnutls_pkcs12_t</span></a> pkcs12</code></em>,
669 <em class="parameter"><code><a class="link" href="gnutls-gnutls.html#gnutls-mac-algorithm-t" title="enum gnutls_mac_algorithm_t"><span class="type">gnutls_mac_algorithm_t</span></a> mac</code></em>,
670 <em class="parameter"><code>const <span class="type">char</span> *pass</code></em>,
671 <em class="parameter"><code>unsigned <span class="type">int</span> flags</code></em>);</pre>
672 <p>This function will generate a MAC for the PKCS12 structure.</p>
673 <p>If <em class="parameter"><code>flags</code></em>
674 contains <a class="link" href="gnutls-pkcs12.html#GNUTLS-PKCS12-USE-PBMAC1:CAPS"><code class="literal">GNUTLS_PKCS12_USE_PBMAC1</code></a>, it uses PBMAC1 key
675 derivation function instead of the PKCS<span class="type">12</span> one.</p>
676 <div class="refsect3">
677 <a name="gnutls-pkcs12-generate-mac3.parameters"></a><h4>Parameters</h4>
678 <div class="informaltable"><table class="informaltable" width="100%" border="0">
679 <colgroup>
680 <col width="150px" class="parameters_name">
681 <col class="parameters_description">
682 <col width="200px" class="parameters_annotations">
683 </colgroup>
684 <tbody>
685 <tr>
686 <td class="parameter_name"><p>pkcs12</p></td>
687 <td class="parameter_description"><p>A pkcs12 type</p></td>
688 <td class="parameter_annotations"> </td>
689 </tr>
690 <tr>
691 <td class="parameter_name"><p>mac</p></td>
692 <td class="parameter_description"><p>the MAC algorithm to use</p></td>
693 <td class="parameter_annotations"> </td>
694 </tr>
695 <tr>
696 <td class="parameter_name"><p>pass</p></td>
697 <td class="parameter_description"><p>The password for the MAC</p></td>
698 <td class="parameter_annotations"> </td>
699 </tr>
700 <tr>
701 <td class="parameter_name"><p>flags</p></td>
702 <td class="parameter_description"><p>an ORed sequence of gnutls_pkcs12_flags_t</p></td>
703 <td class="parameter_annotations"> </td>
704 </tr>
705 </tbody>
706 </table></div>
707 </div>
708 <div class="refsect3">
709 <a name="gnutls-pkcs12-generate-mac3.returns"></a><h4>Returns</h4>
710 <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
711 negative error value.</p>
712 </div>
713 </div>
714 <hr>
715 <div class="refsect2">
716 <a name="gnutls-pkcs12-verify-mac"></a><h3>gnutls_pkcs12_verify_mac ()</h3>
717 <pre class="programlisting"><span class="returnvalue">int</span>
718 gnutls_pkcs12_verify_mac (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-t" title="gnutls_pkcs12_t"><span class="type">gnutls_pkcs12_t</span></a> pkcs12</code></em>,
719 <em class="parameter"><code>const <span class="type">char</span> *pass</code></em>);</pre>
720 <p>This function will verify the MAC for the PKCS12 structure.</p>
721 <div class="refsect3">
722 <a name="gnutls-pkcs12-verify-mac.parameters"></a><h4>Parameters</h4>
723 <div class="informaltable"><table class="informaltable" width="100%" border="0">
724 <colgroup>
725 <col width="150px" class="parameters_name">
726 <col class="parameters_description">
727 <col width="200px" class="parameters_annotations">
728 </colgroup>
729 <tbody>
730 <tr>
731 <td class="parameter_name"><p>pkcs12</p></td>
732 <td class="parameter_description"><p>should contain a gnutls_pkcs12_t type</p></td>
733 <td class="parameter_annotations"> </td>
734 </tr>
735 <tr>
736 <td class="parameter_name"><p>pass</p></td>
737 <td class="parameter_description"><p>The password for the MAC</p></td>
738 <td class="parameter_annotations"> </td>
739 </tr>
740 </tbody>
741 </table></div>
742 </div>
743 <div class="refsect3">
744 <a name="gnutls-pkcs12-verify-mac.returns"></a><h4>Returns</h4>
745 <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
746 negative error value.</p>
747 </div>
748 </div>
749 <hr>
750 <div class="refsect2">
751 <a name="gnutls-pkcs12-bag-decrypt"></a><h3>gnutls_pkcs12_bag_decrypt ()</h3>
752 <pre class="programlisting"><span class="returnvalue">int</span>
753 gnutls_pkcs12_bag_decrypt (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>,
754 <em class="parameter"><code>const <span class="type">char</span> *pass</code></em>);</pre>
755 <p>This function will decrypt the given encrypted bag and return 0 on
756 success.</p>
757 <div class="refsect3">
758 <a name="gnutls-pkcs12-bag-decrypt.parameters"></a><h4>Parameters</h4>
759 <div class="informaltable"><table class="informaltable" width="100%" border="0">
760 <colgroup>
761 <col width="150px" class="parameters_name">
762 <col class="parameters_description">
763 <col width="200px" class="parameters_annotations">
764 </colgroup>
765 <tbody>
766 <tr>
767 <td class="parameter_name"><p>bag</p></td>
768 <td class="parameter_description"><p>The bag</p></td>
769 <td class="parameter_annotations"> </td>
770 </tr>
771 <tr>
772 <td class="parameter_name"><p>pass</p></td>
773 <td class="parameter_description"><p>The password used for encryption, must be ASCII.</p></td>
774 <td class="parameter_annotations"> </td>
775 </tr>
776 </tbody>
777 </table></div>
778 </div>
779 <div class="refsect3">
780 <a name="gnutls-pkcs12-bag-decrypt.returns"></a><h4>Returns</h4>
781 <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,
782 otherwise a negative error code is returned.</p>
783 </div>
784 </div>
785 <hr>
786 <div class="refsect2">
787 <a name="gnutls-pkcs12-bag-encrypt"></a><h3>gnutls_pkcs12_bag_encrypt ()</h3>
788 <pre class="programlisting"><span class="returnvalue">int</span>
789 gnutls_pkcs12_bag_encrypt (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>,
790 <em class="parameter"><code>const <span class="type">char</span> *pass</code></em>,
791 <em class="parameter"><code>unsigned <span class="type">int</span> flags</code></em>);</pre>
792 <p>This function will encrypt the given bag.</p>
793 <div class="refsect3">
794 <a name="gnutls-pkcs12-bag-encrypt.parameters"></a><h4>Parameters</h4>
795 <div class="informaltable"><table class="informaltable" width="100%" border="0">
796 <colgroup>
797 <col width="150px" class="parameters_name">
798 <col class="parameters_description">
799 <col width="200px" class="parameters_annotations">
800 </colgroup>
801 <tbody>
802 <tr>
803 <td class="parameter_name"><p>bag</p></td>
804 <td class="parameter_description"><p>The bag</p></td>
805 <td class="parameter_annotations"> </td>
806 </tr>
807 <tr>
808 <td class="parameter_name"><p>pass</p></td>
809 <td class="parameter_description"><p>The password used for encryption, must be ASCII</p></td>
810 <td class="parameter_annotations"> </td>
811 </tr>
812 <tr>
813 <td class="parameter_name"><p>flags</p></td>
814 <td class="parameter_description"><p>should be one of <a class="link" href="gnutls-x509.html#gnutls-pkcs-encrypt-flags-t" title="enum gnutls_pkcs_encrypt_flags_t"><span class="type">gnutls_pkcs_encrypt_flags_t</span></a> elements bitwise or'd</p></td>
815 <td class="parameter_annotations"> </td>
816 </tr>
817 </tbody>
818 </table></div>
819 </div>
820 <div class="refsect3">
821 <a name="gnutls-pkcs12-bag-encrypt.returns"></a><h4>Returns</h4>
822 <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,
823 otherwise a negative error code is returned.</p>
824 </div>
825 </div>
826 <hr>
827 <div class="refsect2">
828 <a name="gnutls-pkcs12-bag-enc-info"></a><h3>gnutls_pkcs12_bag_enc_info ()</h3>
829 <pre class="programlisting"><span class="returnvalue">int</span>
830 gnutls_pkcs12_bag_enc_info (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>,
831 <em class="parameter"><code>unsigned <span class="type">int</span> *schema</code></em>,
832 <em class="parameter"><code>unsigned <span class="type">int</span> *cipher</code></em>,
833 <em class="parameter"><code><span class="type">void</span> *salt</code></em>,
834 <em class="parameter"><code>unsigned <span class="type">int</span> *salt_size</code></em>,
835 <em class="parameter"><code>unsigned <span class="type">int</span> *iter_count</code></em>,
836 <em class="parameter"><code><span class="type">char</span> **oid</code></em>);</pre>
837 <p>This function will provide information on the encryption algorithms used
838 in an encrypted bag. If the structure algorithms
839 are unknown the code <a class="link" href="gnutls-gnutls.html#GNUTLS-E-UNKNOWN-CIPHER-TYPE:CAPS" title="GNUTLS_E_UNKNOWN_CIPHER_TYPE"><code class="literal">GNUTLS_E_UNKNOWN_CIPHER_TYPE</code></a> will be returned,
840 and only <em class="parameter"><code>oid</code></em>
841 , will be set. That is, <em class="parameter"><code>oid</code></em>
842 will be set on encrypted bags
843 whether supported or not. It must be deinitialized using <a class="link" href="gnutls-gnutls.html#gnutls-free" title="gnutls_free()"><code class="function">gnutls_free()</code></a>.
844 The other variables are only set on supported structures.</p>
845 <div class="refsect3">
846 <a name="gnutls-pkcs12-bag-enc-info.parameters"></a><h4>Parameters</h4>
847 <div class="informaltable"><table class="informaltable" width="100%" border="0">
848 <colgroup>
849 <col width="150px" class="parameters_name">
850 <col class="parameters_description">
851 <col width="200px" class="parameters_annotations">
852 </colgroup>
853 <tbody>
854 <tr>
855 <td class="parameter_name"><p>bag</p></td>
856 <td class="parameter_description"><p>The bag</p></td>
857 <td class="parameter_annotations"> </td>
858 </tr>
859 <tr>
860 <td class="parameter_name"><p>schema</p></td>
861 <td class="parameter_description"><p>indicate the schema as one of <a class="link" href="gnutls-x509.html#gnutls-pkcs-encrypt-flags-t" title="enum gnutls_pkcs_encrypt_flags_t"><code class="literal">gnutls_pkcs_encrypt_flags_t</code></a></p></td>
862 <td class="parameter_annotations"> </td>
863 </tr>
864 <tr>
865 <td class="parameter_name"><p>cipher</p></td>
866 <td class="parameter_description"><p>the cipher used as <a class="link" href="gnutls-gnutls.html#gnutls-cipher-algorithm-t" title="enum gnutls_cipher_algorithm_t"><code class="literal">gnutls_cipher_algorithm_t</code></a></p></td>
867 <td class="parameter_annotations"> </td>
868 </tr>
869 <tr>
870 <td class="parameter_name"><p>salt</p></td>
871 <td class="parameter_description"><p>PBKDF2 salt (if non-NULL then <em class="parameter"><code>salt_size</code></em>
872 initially holds its size)</p></td>
873 <td class="parameter_annotations"> </td>
874 </tr>
875 <tr>
876 <td class="parameter_name"><p>salt_size</p></td>
877 <td class="parameter_description"><p>PBKDF2 salt size</p></td>
878 <td class="parameter_annotations"> </td>
879 </tr>
880 <tr>
881 <td class="parameter_name"><p>iter_count</p></td>
882 <td class="parameter_description"><p>PBKDF2 iteration count</p></td>
883 <td class="parameter_annotations"> </td>
884 </tr>
885 <tr>
886 <td class="parameter_name"><p>oid</p></td>
887 <td class="parameter_description"><p>if non-NULL it will contain an allocated null-terminated variable with the OID</p></td>
888 <td class="parameter_annotations"> </td>
889 </tr>
890 </tbody>
891 </table></div>
892 </div>
893 <div class="refsect3">
894 <a name="gnutls-pkcs12-bag-enc-info.returns"></a><h4>Returns</h4>
895 <p> <a class="link" href="gnutls-gnutls.html#GNUTLS-E-INVALID-REQUEST:CAPS" title="GNUTLS_E_INVALID_REQUEST"><code class="literal">GNUTLS_E_INVALID_REQUEST</code></a> if the provided bag isn't encrypted,
896 <a class="link" href="gnutls-gnutls.html#GNUTLS-E-UNKNOWN-CIPHER-TYPE:CAPS" title="GNUTLS_E_UNKNOWN_CIPHER_TYPE"><code class="literal">GNUTLS_E_UNKNOWN_CIPHER_TYPE</code></a> if the structure's encryption isn't supported, or
897 another negative error code in case of a failure. Zero on success.</p>
898 </div>
899 </div>
900 <hr>
901 <div class="refsect2">
902 <a name="gnutls-pkcs12-mac-info"></a><h3>gnutls_pkcs12_mac_info ()</h3>
903 <pre class="programlisting"><span class="returnvalue">int</span>
904 gnutls_pkcs12_mac_info (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-t" title="gnutls_pkcs12_t"><span class="type">gnutls_pkcs12_t</span></a> pkcs12</code></em>,
905 <em class="parameter"><code>unsigned <span class="type">int</span> *mac</code></em>,
906 <em class="parameter"><code><span class="type">void</span> *salt</code></em>,
907 <em class="parameter"><code>unsigned <span class="type">int</span> *salt_size</code></em>,
908 <em class="parameter"><code>unsigned <span class="type">int</span> *iter_count</code></em>,
909 <em class="parameter"><code><span class="type">char</span> **oid</code></em>);</pre>
910 <p>This function will provide information on the MAC algorithm used
911 in a PKCS <span class="type">12</span> structure. If the structure algorithms
912 are unknown the code <a class="link" href="gnutls-gnutls.html#GNUTLS-E-UNKNOWN-HASH-ALGORITHM:CAPS" title="GNUTLS_E_UNKNOWN_HASH_ALGORITHM"><code class="literal">GNUTLS_E_UNKNOWN_HASH_ALGORITHM</code></a> will be returned,
913 and only <em class="parameter"><code>oid</code></em>
914 , will be set. That is, <em class="parameter"><code>oid</code></em>
915 will be set on structures
916 with a MAC whether supported or not. It must be deinitialized using <a class="link" href="gnutls-gnutls.html#gnutls-free" title="gnutls_free()"><code class="function">gnutls_free()</code></a>.
917 The other variables are only set on supported structures.</p>
918 <div class="refsect3">
919 <a name="gnutls-pkcs12-mac-info.parameters"></a><h4>Parameters</h4>
920 <div class="informaltable"><table class="informaltable" width="100%" border="0">
921 <colgroup>
922 <col width="150px" class="parameters_name">
923 <col class="parameters_description">
924 <col width="200px" class="parameters_annotations">
925 </colgroup>
926 <tbody>
927 <tr>
928 <td class="parameter_name"><p>pkcs12</p></td>
929 <td class="parameter_description"><p>A pkcs12 type</p></td>
930 <td class="parameter_annotations"> </td>
931 </tr>
932 <tr>
933 <td class="parameter_name"><p>mac</p></td>
934 <td class="parameter_description"><p>the MAC algorithm used as <a class="link" href="gnutls-gnutls.html#gnutls-mac-algorithm-t" title="enum gnutls_mac_algorithm_t"><code class="literal">gnutls_mac_algorithm_t</code></a></p></td>
935 <td class="parameter_annotations"> </td>
936 </tr>
937 <tr>
938 <td class="parameter_name"><p>salt</p></td>
939 <td class="parameter_description"><p>the salt used for string to key (if non-NULL then <em class="parameter"><code>salt_size</code></em>
940 initially holds its size)</p></td>
941 <td class="parameter_annotations"> </td>
942 </tr>
943 <tr>
944 <td class="parameter_name"><p>salt_size</p></td>
945 <td class="parameter_description"><p>string to key salt size</p></td>
946 <td class="parameter_annotations"> </td>
947 </tr>
948 <tr>
949 <td class="parameter_name"><p>iter_count</p></td>
950 <td class="parameter_description"><p>string to key iteration count</p></td>
951 <td class="parameter_annotations"> </td>
952 </tr>
953 <tr>
954 <td class="parameter_name"><p>oid</p></td>
955 <td class="parameter_description"><p>if non-NULL it will contain an allocated null-terminated variable with the OID</p></td>
956 <td class="parameter_annotations"> </td>
957 </tr>
958 </tbody>
959 </table></div>
960 </div>
961 <div class="refsect3">
962 <a name="gnutls-pkcs12-mac-info.returns"></a><h4>Returns</h4>
963 <p> <a class="link" href="gnutls-gnutls.html#GNUTLS-E-INVALID-REQUEST:CAPS" title="GNUTLS_E_INVALID_REQUEST"><code class="literal">GNUTLS_E_INVALID_REQUEST</code></a> if the provided structure doesn't contain a MAC,
964 <a class="link" href="gnutls-gnutls.html#GNUTLS-E-UNKNOWN-HASH-ALGORITHM:CAPS" title="GNUTLS_E_UNKNOWN_HASH_ALGORITHM"><code class="literal">GNUTLS_E_UNKNOWN_HASH_ALGORITHM</code></a> if the structure's MAC isn't supported, or
965 another negative error code in case of a failure. Zero on success.</p>
966 </div>
967 </div>
968 <hr>
969 <div class="refsect2">
970 <a name="gnutls-pkcs12-simple-parse"></a><h3>gnutls_pkcs12_simple_parse ()</h3>
971 <pre class="programlisting"><span class="returnvalue">int</span>
972 gnutls_pkcs12_simple_parse (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-t" title="gnutls_pkcs12_t"><span class="type">gnutls_pkcs12_t</span></a> p12</code></em>,
973 <em class="parameter"><code>const <span class="type">char</span> *password</code></em>,
974 <em class="parameter"><code><a class="link" href="gnutls-gnutls.html#gnutls-x509-privkey-t" title="gnutls_x509_privkey_t"><span class="type">gnutls_x509_privkey_t</span></a> *key</code></em>,
975 <em class="parameter"><code><a class="link" href="gnutls-gnutls.html#gnutls-x509-crt-t" title="gnutls_x509_crt_t"><span class="type">gnutls_x509_crt_t</span></a> **chain</code></em>,
976 <em class="parameter"><code>unsigned <span class="type">int</span> *chain_len</code></em>,
977 <em class="parameter"><code><a class="link" href="gnutls-gnutls.html#gnutls-x509-crt-t" title="gnutls_x509_crt_t"><span class="type">gnutls_x509_crt_t</span></a> **extra_certs</code></em>,
978 <em class="parameter"><code>unsigned <span class="type">int</span> *extra_certs_len</code></em>,
979 <em class="parameter"><code><a class="link" href="gnutls-gnutls.html#gnutls-x509-crl-t" title="gnutls_x509_crl_t"><span class="type">gnutls_x509_crl_t</span></a> *crl</code></em>,
980 <em class="parameter"><code>unsigned <span class="type">int</span> flags</code></em>);</pre>
981 <p>This function parses a PKCS12 structure in <em class="parameter"><code>pkcs12</code></em>
982 and extracts the
983 private key, the corresponding certificate chain, any additional
984 certificates and a CRL. The structures in <em class="parameter"><code>key</code></em>
985 , <em class="parameter"><code>chain</code></em>
986 <em class="parameter"><code>crl</code></em>
987 , and <em class="parameter"><code>extra_certs</code></em>
988
989 must not be initialized.</p>
990 <p>The <em class="parameter"><code>extra_certs</code></em>
991 and <em class="parameter"><code>extra_certs_len</code></em>
992 parameters are optional
993 and both may be set to <code class="literal">NULL</code>. If either is non-<code class="literal">NULL</code>, then both must
994 be set. The value for <em class="parameter"><code>extra_certs</code></em>
995 is allocated
996 using <code class="function">gnutls_malloc()</code>.</p>
997 <p>Encrypted PKCS12 bags and PKCS8 private keys are supported, but
998 only with password based security and the same password for all
999 operations.</p>
1000 <p>Note that a PKCS12 structure may contain many keys and/or certificates,
1001 and there is no way to identify which key/certificate pair you want.
1002 For this reason this function is useful for PKCS12 files that contain
1003 only one key/certificate pair and/or one CRL.</p>
1004 <p>If the provided structure has encrypted fields but no password
1005 is provided then this function returns <a class="link" href="gnutls-gnutls.html#GNUTLS-E-DECRYPTION-FAILED:CAPS" title="GNUTLS_E_DECRYPTION_FAILED"><code class="literal">GNUTLS_E_DECRYPTION_FAILED</code></a>.</p>
1006 <p>Note that normally the chain constructed does not include self signed
1007 certificates, to comply with TLS' requirements. If, however, the flag
1008 <a class="link" href="gnutls-pkcs12.html#GNUTLS-PKCS12-SP-INCLUDE-SELF-SIGNED:CAPS" title="GNUTLS_PKCS12_SP_INCLUDE_SELF_SIGNED"><code class="literal">GNUTLS_PKCS12_SP_INCLUDE_SELF_SIGNED</code></a> is specified then
1009 self signed certificates will be included in the chain.</p>
1010 <p>Prior to using this function the PKCS <span class="type">12</span> structure integrity must
1011 be verified using <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-verify-mac" title="gnutls_pkcs12_verify_mac ()"><code class="function">gnutls_pkcs12_verify_mac()</code></a>.</p>
1012 <div class="refsect3">
1013 <a name="gnutls-pkcs12-simple-parse.parameters"></a><h4>Parameters</h4>
1014 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1015 <colgroup>
1016 <col width="150px" class="parameters_name">
1017 <col class="parameters_description">
1018 <col width="200px" class="parameters_annotations">
1019 </colgroup>
1020 <tbody>
1021 <tr>
1022 <td class="parameter_name"><p>p12</p></td>
1023 <td class="parameter_description"><p>A pkcs12 type</p></td>
1024 <td class="parameter_annotations"> </td>
1025 </tr>
1026 <tr>
1027 <td class="parameter_name"><p>password</p></td>
1028 <td class="parameter_description"><p>optional password used to decrypt the structure, bags and keys.</p></td>
1029 <td class="parameter_annotations"> </td>
1030 </tr>
1031 <tr>
1032 <td class="parameter_name"><p>key</p></td>
1033 <td class="parameter_description"><p>a structure to store the parsed private key.</p></td>
1034 <td class="parameter_annotations"> </td>
1035 </tr>
1036 <tr>
1037 <td class="parameter_name"><p>chain</p></td>
1038 <td class="parameter_description"><p>the corresponding to key certificate chain (may be <code class="literal">NULL</code>)</p></td>
1039 <td class="parameter_annotations"> </td>
1040 </tr>
1041 <tr>
1042 <td class="parameter_name"><p>chain_len</p></td>
1043 <td class="parameter_description"><p>will be updated with the number of additional (may be <code class="literal">NULL</code>)</p></td>
1044 <td class="parameter_annotations"> </td>
1045 </tr>
1046 <tr>
1047 <td class="parameter_name"><p>extra_certs</p></td>
1048 <td class="parameter_description"><p>optional pointer to receive an array of additional
1049 certificates found in the PKCS12 structure (may be <code class="literal">NULL</code>).</p></td>
1050 <td class="parameter_annotations"> </td>
1051 </tr>
1052 <tr>
1053 <td class="parameter_name"><p>extra_certs_len</p></td>
1054 <td class="parameter_description"><p>will be updated with the number of additional
1055 certs (may be <code class="literal">NULL</code>).</p></td>
1056 <td class="parameter_annotations"> </td>
1057 </tr>
1058 <tr>
1059 <td class="parameter_name"><p>crl</p></td>
1060 <td class="parameter_description"><p>an optional structure to store the parsed CRL (may be <code class="literal">NULL</code>).</p></td>
1061 <td class="parameter_annotations"> </td>
1062 </tr>
1063 <tr>
1064 <td class="parameter_name"><p>flags</p></td>
1065 <td class="parameter_description"><p>should be zero or one of GNUTLS_PKCS12_SP_*</p></td>
1066 <td class="parameter_annotations"> </td>
1067 </tr>
1068 </tbody>
1069 </table></div>
1070 </div>
1071 <div class="refsect3">
1072 <a name="gnutls-pkcs12-simple-parse.returns"></a><h4>Returns</h4>
1073 <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
1074 negative error value.</p>
1075 </div>
1076 <p class="since">Since: 3.1.0</p>
1077 </div>
1078 <hr>
1079 <div class="refsect2">
1080 <a name="gnutls-pkcs12-bag-get-data"></a><h3>gnutls_pkcs12_bag_get_data ()</h3>
1081 <pre class="programlisting"><span class="returnvalue">int</span>
1082 gnutls_pkcs12_bag_get_data (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>,
1083 <em class="parameter"><code><span class="type">unsigned </span> indx</code></em>,
1084 <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> *data</code></em>);</pre>
1085 <p>This function will return the bag's data. The data is a constant
1086 that is stored into the bag. Should not be accessed after the bag
1087 is deleted.</p>
1088 <div class="refsect3">
1089 <a name="gnutls-pkcs12-bag-get-data.parameters"></a><h4>Parameters</h4>
1090 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1091 <colgroup>
1092 <col width="150px" class="parameters_name">
1093 <col class="parameters_description">
1094 <col width="200px" class="parameters_annotations">
1095 </colgroup>
1096 <tbody>
1097 <tr>
1098 <td class="parameter_name"><p>bag</p></td>
1099 <td class="parameter_description"><p>The bag</p></td>
1100 <td class="parameter_annotations"> </td>
1101 </tr>
1102 <tr>
1103 <td class="parameter_name"><p>indx</p></td>
1104 <td class="parameter_description"><p>The element of the bag to get the data from</p></td>
1105 <td class="parameter_annotations"> </td>
1106 </tr>
1107 <tr>
1108 <td class="parameter_name"><p>data</p></td>
1109 <td class="parameter_description"><p>where the bag's data will be. Should be treated as constant.</p></td>
1110 <td class="parameter_annotations"> </td>
1111 </tr>
1112 </tbody>
1113 </table></div>
1114 </div>
1115 <div class="refsect3">
1116 <a name="gnutls-pkcs12-bag-get-data.returns"></a><h4>Returns</h4>
1117 <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
1118 negative error value.</p>
1119 </div>
1120 </div>
1121 <hr>
1122 <div class="refsect2">
1123 <a name="gnutls-pkcs12-bag-set-data"></a><h3>gnutls_pkcs12_bag_set_data ()</h3>
1124 <pre class="programlisting"><span class="returnvalue">int</span>
1125 gnutls_pkcs12_bag_set_data (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>,
1126 <em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-type-t" title="enum gnutls_pkcs12_bag_type_t"><span class="type">gnutls_pkcs12_bag_type_t</span></a> type</code></em>,
1127 <em class="parameter"><code>const <a class="link" href="gnutls-gnutls.html#gnutls-datum-t" title="gnutls_datum_t"><span class="type">gnutls_datum_t</span></a> *data</code></em>);</pre>
1128 <p>This function will insert the given data of the given type into
1129 the bag.</p>
1130 <div class="refsect3">
1131 <a name="gnutls-pkcs12-bag-set-data.parameters"></a><h4>Parameters</h4>
1132 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1133 <colgroup>
1134 <col width="150px" class="parameters_name">
1135 <col class="parameters_description">
1136 <col width="200px" class="parameters_annotations">
1137 </colgroup>
1138 <tbody>
1139 <tr>
1140 <td class="parameter_name"><p>bag</p></td>
1141 <td class="parameter_description"><p>The bag</p></td>
1142 <td class="parameter_annotations"> </td>
1143 </tr>
1144 <tr>
1145 <td class="parameter_name"><p>type</p></td>
1146 <td class="parameter_description"><p>The data's type</p></td>
1147 <td class="parameter_annotations"> </td>
1148 </tr>
1149 <tr>
1150 <td class="parameter_name"><p>data</p></td>
1151 <td class="parameter_description"><p>the data to be copied.</p></td>
1152 <td class="parameter_annotations"> </td>
1153 </tr>
1154 </tbody>
1155 </table></div>
1156 </div>
1157 <div class="refsect3">
1158 <a name="gnutls-pkcs12-bag-set-data.returns"></a><h4>Returns</h4>
1159 <p> the index of the added bag on success, or a negative
1160 value on error.</p>
1161 </div>
1162 </div>
1163 <hr>
1164 <div class="refsect2">
1165 <a name="gnutls-pkcs12-bag-set-crl"></a><h3>gnutls_pkcs12_bag_set_crl ()</h3>
1166 <pre class="programlisting"><span class="returnvalue">int</span>
1167 gnutls_pkcs12_bag_set_crl (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>,
1168 <em class="parameter"><code><a class="link" href="gnutls-gnutls.html#gnutls-x509-crl-t" title="gnutls_x509_crl_t"><span class="type">gnutls_x509_crl_t</span></a> crl</code></em>);</pre>
1169 <p>This function will insert the given CRL into the
1170 bag. This is just a wrapper over <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-set-data" title="gnutls_pkcs12_bag_set_data ()"><code class="function">gnutls_pkcs12_bag_set_data()</code></a>.</p>
1171 <div class="refsect3">
1172 <a name="gnutls-pkcs12-bag-set-crl.parameters"></a><h4>Parameters</h4>
1173 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1174 <colgroup>
1175 <col width="150px" class="parameters_name">
1176 <col class="parameters_description">
1177 <col width="200px" class="parameters_annotations">
1178 </colgroup>
1179 <tbody>
1180 <tr>
1181 <td class="parameter_name"><p>bag</p></td>
1182 <td class="parameter_description"><p>The bag</p></td>
1183 <td class="parameter_annotations"> </td>
1184 </tr>
1185 <tr>
1186 <td class="parameter_name"><p>crl</p></td>
1187 <td class="parameter_description"><p>the CRL to be copied.</p></td>
1188 <td class="parameter_annotations"> </td>
1189 </tr>
1190 </tbody>
1191 </table></div>
1192 </div>
1193 <div class="refsect3">
1194 <a name="gnutls-pkcs12-bag-set-crl.returns"></a><h4>Returns</h4>
1195 <p> the index of the added bag on success, or a negative error code
1196 on failure.</p>
1197 </div>
1198 </div>
1199 <hr>
1200 <div class="refsect2">
1201 <a name="gnutls-pkcs12-bag-set-crt"></a><h3>gnutls_pkcs12_bag_set_crt ()</h3>
1202 <pre class="programlisting"><span class="returnvalue">int</span>
1203 gnutls_pkcs12_bag_set_crt (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>,
1204 <em class="parameter"><code><a class="link" href="gnutls-gnutls.html#gnutls-x509-crt-t" title="gnutls_x509_crt_t"><span class="type">gnutls_x509_crt_t</span></a> crt</code></em>);</pre>
1205 <p>This function will insert the given certificate into the
1206 bag. This is just a wrapper over <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-set-data" title="gnutls_pkcs12_bag_set_data ()"><code class="function">gnutls_pkcs12_bag_set_data()</code></a>.</p>
1207 <div class="refsect3">
1208 <a name="gnutls-pkcs12-bag-set-crt.parameters"></a><h4>Parameters</h4>
1209 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1210 <colgroup>
1211 <col width="150px" class="parameters_name">
1212 <col class="parameters_description">
1213 <col width="200px" class="parameters_annotations">
1214 </colgroup>
1215 <tbody>
1216 <tr>
1217 <td class="parameter_name"><p>bag</p></td>
1218 <td class="parameter_description"><p>The bag</p></td>
1219 <td class="parameter_annotations"> </td>
1220 </tr>
1221 <tr>
1222 <td class="parameter_name"><p>crt</p></td>
1223 <td class="parameter_description"><p>the certificate to be copied.</p></td>
1224 <td class="parameter_annotations"> </td>
1225 </tr>
1226 </tbody>
1227 </table></div>
1228 </div>
1229 <div class="refsect3">
1230 <a name="gnutls-pkcs12-bag-set-crt.returns"></a><h4>Returns</h4>
1231 <p> the index of the added bag on success, or a negative
1232 value on failure.</p>
1233 </div>
1234 </div>
1235 <hr>
1236 <div class="refsect2">
1237 <a name="gnutls-pkcs12-bag-set-privkey"></a><h3>gnutls_pkcs12_bag_set_privkey ()</h3>
1238 <pre class="programlisting"><span class="returnvalue">int</span>
1239 gnutls_pkcs12_bag_set_privkey (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>,
1240 <em class="parameter"><code><a class="link" href="gnutls-gnutls.html#gnutls-x509-privkey-t" title="gnutls_x509_privkey_t"><span class="type">gnutls_x509_privkey_t</span></a> privkey</code></em>,
1241 <em class="parameter"><code>const <span class="type">char</span> *password</code></em>,
1242 <em class="parameter"><code><span class="type">unsigned </span> flags</code></em>);</pre>
1243 <p>This function will insert the given private key into the
1244 bag. This is just a wrapper over <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-set-data" title="gnutls_pkcs12_bag_set_data ()"><code class="function">gnutls_pkcs12_bag_set_data()</code></a>.</p>
1245 <div class="refsect3">
1246 <a name="gnutls-pkcs12-bag-set-privkey.parameters"></a><h4>Parameters</h4>
1247 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1248 <colgroup>
1249 <col width="150px" class="parameters_name">
1250 <col class="parameters_description">
1251 <col width="200px" class="parameters_annotations">
1252 </colgroup>
1253 <tbody>
1254 <tr>
1255 <td class="parameter_name"><p>bag</p></td>
1256 <td class="parameter_description"><p>The bag</p></td>
1257 <td class="parameter_annotations"> </td>
1258 </tr>
1259 <tr>
1260 <td class="parameter_name"><p>privkey</p></td>
1261 <td class="parameter_description"><p>the private key to be copied.</p></td>
1262 <td class="parameter_annotations"> </td>
1263 </tr>
1264 <tr>
1265 <td class="parameter_name"><p>password</p></td>
1266 <td class="parameter_description"><p>the password to protect the key with (may be <code class="literal">NULL</code>)</p></td>
1267 <td class="parameter_annotations"> </td>
1268 </tr>
1269 <tr>
1270 <td class="parameter_name"><p>flags</p></td>
1271 <td class="parameter_description"><p>should be one of <a class="link" href="gnutls-x509.html#gnutls-pkcs-encrypt-flags-t" title="enum gnutls_pkcs_encrypt_flags_t"><span class="type">gnutls_pkcs_encrypt_flags_t</span></a> elements bitwise or'd</p></td>
1272 <td class="parameter_annotations"> </td>
1273 </tr>
1274 </tbody>
1275 </table></div>
1276 </div>
1277 <div class="refsect3">
1278 <a name="gnutls-pkcs12-bag-set-privkey.returns"></a><h4>Returns</h4>
1279 <p> the index of the added bag on success, or a negative
1280 value on failure.</p>
1281 </div>
1282 </div>
1283 <hr>
1284 <div class="refsect2">
1285 <a name="gnutls-pkcs12-bag-init"></a><h3>gnutls_pkcs12_bag_init ()</h3>
1286 <pre class="programlisting"><span class="returnvalue">int</span>
1287 gnutls_pkcs12_bag_init (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> *bag</code></em>);</pre>
1288 <p>This function will initialize a PKCS12 bag structure. PKCS12 Bags
1289 usually contain private keys, lists of X.509 Certificates and X.509
1290 Certificate revocation lists.</p>
1291 <div class="refsect3">
1292 <a name="gnutls-pkcs12-bag-init.parameters"></a><h4>Parameters</h4>
1293 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1294 <colgroup>
1295 <col width="150px" class="parameters_name">
1296 <col class="parameters_description">
1297 <col width="200px" class="parameters_annotations">
1298 </colgroup>
1299 <tbody><tr>
1300 <td class="parameter_name"><p>bag</p></td>
1301 <td class="parameter_description"><p>A pointer to the type to be initialized</p></td>
1302 <td class="parameter_annotations"> </td>
1303 </tr></tbody>
1304 </table></div>
1305 </div>
1306 <div class="refsect3">
1307 <a name="gnutls-pkcs12-bag-init.returns"></a><h4>Returns</h4>
1308 <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
1309 negative error value.</p>
1310 </div>
1311 </div>
1312 <hr>
1313 <div class="refsect2">
1314 <a name="gnutls-pkcs12-bag-deinit"></a><h3>gnutls_pkcs12_bag_deinit ()</h3>
1315 <pre class="programlisting"><span class="returnvalue">void</span>
1316 gnutls_pkcs12_bag_deinit (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>);</pre>
1317 <p>This function will deinitialize a PKCS12 Bag structure.</p>
1318 <div class="refsect3">
1319 <a name="gnutls-pkcs12-bag-deinit.parameters"></a><h4>Parameters</h4>
1320 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1321 <colgroup>
1322 <col width="150px" class="parameters_name">
1323 <col class="parameters_description">
1324 <col width="200px" class="parameters_annotations">
1325 </colgroup>
1326 <tbody><tr>
1327 <td class="parameter_name"><p>bag</p></td>
1328 <td class="parameter_description"><p>A pointer to the type to be initialized</p></td>
1329 <td class="parameter_annotations"> </td>
1330 </tr></tbody>
1331 </table></div>
1332 </div>
1333 </div>
1334 <hr>
1335 <div class="refsect2">
1336 <a name="gnutls-pkcs12-bag-get-count"></a><h3>gnutls_pkcs12_bag_get_count ()</h3>
1337 <pre class="programlisting"><span class="returnvalue">int</span>
1338 gnutls_pkcs12_bag_get_count (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>);</pre>
1339 <p>This function will return the number of the elements within the bag.</p>
1340 <div class="refsect3">
1341 <a name="gnutls-pkcs12-bag-get-count.parameters"></a><h4>Parameters</h4>
1342 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1343 <colgroup>
1344 <col width="150px" class="parameters_name">
1345 <col class="parameters_description">
1346 <col width="200px" class="parameters_annotations">
1347 </colgroup>
1348 <tbody><tr>
1349 <td class="parameter_name"><p>bag</p></td>
1350 <td class="parameter_description"><p>The bag</p></td>
1351 <td class="parameter_annotations"> </td>
1352 </tr></tbody>
1353 </table></div>
1354 </div>
1355 <div class="refsect3">
1356 <a name="gnutls-pkcs12-bag-get-count.returns"></a><h4>Returns</h4>
1357 <p> Number of elements in bag, or an negative error code on
1358 error.</p>
1359 </div>
1360 </div>
1361 <hr>
1362 <div class="refsect2">
1363 <a name="gnutls-pkcs12-bag-get-key-id"></a><h3>gnutls_pkcs12_bag_get_key_id ()</h3>
1364 <pre class="programlisting"><span class="returnvalue">int</span>
1365 gnutls_pkcs12_bag_get_key_id (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>,
1366 <em class="parameter"><code><span class="type">unsigned </span> indx</code></em>,
1367 <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> *id</code></em>);</pre>
1368 <p>This function will return the key ID, of the specified bag element.
1369 The key ID is usually used to distinguish the local private key and
1370 the certificate pair.</p>
1371 <div class="refsect3">
1372 <a name="gnutls-pkcs12-bag-get-key-id.parameters"></a><h4>Parameters</h4>
1373 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1374 <colgroup>
1375 <col width="150px" class="parameters_name">
1376 <col class="parameters_description">
1377 <col width="200px" class="parameters_annotations">
1378 </colgroup>
1379 <tbody>
1380 <tr>
1381 <td class="parameter_name"><p>bag</p></td>
1382 <td class="parameter_description"><p>The bag</p></td>
1383 <td class="parameter_annotations"> </td>
1384 </tr>
1385 <tr>
1386 <td class="parameter_name"><p>indx</p></td>
1387 <td class="parameter_description"><p>The bag's element to add the id</p></td>
1388 <td class="parameter_annotations"> </td>
1389 </tr>
1390 <tr>
1391 <td class="parameter_name"><p>id</p></td>
1392 <td class="parameter_description"><p>where the ID will be copied (to be treated as const)</p></td>
1393 <td class="parameter_annotations"> </td>
1394 </tr>
1395 </tbody>
1396 </table></div>
1397 </div>
1398 <div class="refsect3">
1399 <a name="gnutls-pkcs12-bag-get-key-id.returns"></a><h4>Returns</h4>
1400 <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
1401 negative error value. or a negative error code on error.</p>
1402 </div>
1403 </div>
1404 <hr>
1405 <div class="refsect2">
1406 <a name="gnutls-pkcs12-bag-set-key-id"></a><h3>gnutls_pkcs12_bag_set_key_id ()</h3>
1407 <pre class="programlisting"><span class="returnvalue">int</span>
1408 gnutls_pkcs12_bag_set_key_id (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>,
1409 <em class="parameter"><code><span class="type">unsigned </span> indx</code></em>,
1410 <em class="parameter"><code>const <a class="link" href="gnutls-gnutls.html#gnutls-datum-t" title="gnutls_datum_t"><span class="type">gnutls_datum_t</span></a> *id</code></em>);</pre>
1411 <p>This function will add the given key ID, to the specified, by the
1412 index, bag element. The key ID will be encoded as a 'Local key
1413 identifier' bag attribute, which is usually used to distinguish
1414 the local private key and the certificate pair.</p>
1415 <div class="refsect3">
1416 <a name="gnutls-pkcs12-bag-set-key-id.parameters"></a><h4>Parameters</h4>
1417 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1418 <colgroup>
1419 <col width="150px" class="parameters_name">
1420 <col class="parameters_description">
1421 <col width="200px" class="parameters_annotations">
1422 </colgroup>
1423 <tbody>
1424 <tr>
1425 <td class="parameter_name"><p>bag</p></td>
1426 <td class="parameter_description"><p>The bag</p></td>
1427 <td class="parameter_annotations"> </td>
1428 </tr>
1429 <tr>
1430 <td class="parameter_name"><p>indx</p></td>
1431 <td class="parameter_description"><p>The bag's element to add the id</p></td>
1432 <td class="parameter_annotations"> </td>
1433 </tr>
1434 <tr>
1435 <td class="parameter_name"><p>id</p></td>
1436 <td class="parameter_description"><p>the ID</p></td>
1437 <td class="parameter_annotations"> </td>
1438 </tr>
1439 </tbody>
1440 </table></div>
1441 </div>
1442 <div class="refsect3">
1443 <a name="gnutls-pkcs12-bag-set-key-id.returns"></a><h4>Returns</h4>
1444 <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
1445 negative error value. or a negative error code on error.</p>
1446 </div>
1447 </div>
1448 <hr>
1449 <div class="refsect2">
1450 <a name="gnutls-pkcs12-bag-get-friendly-name"></a><h3>gnutls_pkcs12_bag_get_friendly_name ()</h3>
1451 <pre class="programlisting"><span class="returnvalue">int</span>
1452 gnutls_pkcs12_bag_get_friendly_name (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>,
1453 <em class="parameter"><code><span class="type">unsigned </span> indx</code></em>,
1454 <em class="parameter"><code><span class="type">char</span> **name</code></em>);</pre>
1455 <p>This function will return the friendly name, of the specified bag
1456 element. The key ID is usually used to distinguish the local
1457 private key and the certificate pair.</p>
1458 <div class="refsect3">
1459 <a name="gnutls-pkcs12-bag-get-friendly-name.parameters"></a><h4>Parameters</h4>
1460 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1461 <colgroup>
1462 <col width="150px" class="parameters_name">
1463 <col class="parameters_description">
1464 <col width="200px" class="parameters_annotations">
1465 </colgroup>
1466 <tbody>
1467 <tr>
1468 <td class="parameter_name"><p>bag</p></td>
1469 <td class="parameter_description"><p>The bag</p></td>
1470 <td class="parameter_annotations"> </td>
1471 </tr>
1472 <tr>
1473 <td class="parameter_name"><p>indx</p></td>
1474 <td class="parameter_description"><p>The bag's element to add the id</p></td>
1475 <td class="parameter_annotations"> </td>
1476 </tr>
1477 <tr>
1478 <td class="parameter_name"><p>name</p></td>
1479 <td class="parameter_description"><p>will hold a pointer to the name (to be treated as const)</p></td>
1480 <td class="parameter_annotations"> </td>
1481 </tr>
1482 </tbody>
1483 </table></div>
1484 </div>
1485 <div class="refsect3">
1486 <a name="gnutls-pkcs12-bag-get-friendly-name.returns"></a><h4>Returns</h4>
1487 <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
1488 negative error value. or a negative error code on error.</p>
1489 </div>
1490 </div>
1491 <hr>
1492 <div class="refsect2">
1493 <a name="gnutls-pkcs12-bag-set-friendly-name"></a><h3>gnutls_pkcs12_bag_set_friendly_name ()</h3>
1494 <pre class="programlisting"><span class="returnvalue">int</span>
1495 gnutls_pkcs12_bag_set_friendly_name (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>,
1496 <em class="parameter"><code><span class="type">unsigned </span> indx</code></em>,
1497 <em class="parameter"><code>const <span class="type">char</span> *name</code></em>);</pre>
1498 <p>This function will add the given key friendly name, to the
1499 specified, by the index, bag element. The name will be encoded as
1500 a 'Friendly name' bag attribute, which is usually used to set a
1501 user name to the local private key and the certificate pair.</p>
1502 <div class="refsect3">
1503 <a name="gnutls-pkcs12-bag-set-friendly-name.parameters"></a><h4>Parameters</h4>
1504 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1505 <colgroup>
1506 <col width="150px" class="parameters_name">
1507 <col class="parameters_description">
1508 <col width="200px" class="parameters_annotations">
1509 </colgroup>
1510 <tbody>
1511 <tr>
1512 <td class="parameter_name"><p>bag</p></td>
1513 <td class="parameter_description"><p>The bag</p></td>
1514 <td class="parameter_annotations"> </td>
1515 </tr>
1516 <tr>
1517 <td class="parameter_name"><p>indx</p></td>
1518 <td class="parameter_description"><p>The bag's element to add the id</p></td>
1519 <td class="parameter_annotations"> </td>
1520 </tr>
1521 <tr>
1522 <td class="parameter_name"><p>name</p></td>
1523 <td class="parameter_description"><p>the name</p></td>
1524 <td class="parameter_annotations"> </td>
1525 </tr>
1526 </tbody>
1527 </table></div>
1528 </div>
1529 <div class="refsect3">
1530 <a name="gnutls-pkcs12-bag-set-friendly-name.returns"></a><h4>Returns</h4>
1531 <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
1532 negative error value. or a negative error code on error.</p>
1533 </div>
1534 </div>
1535 </div>
1536 <div class="refsect1">
1537 <a name="gnutls-pkcs12.other_details"></a><h2>Types and Values</h2>
1538 <div class="refsect2">
1539 <a name="gnutls-pkcs12-t"></a><h3>gnutls_pkcs12_t</h3>
1540 <pre class="programlisting">typedef struct gnutls_pkcs12_int *gnutls_pkcs12_t;
1541 </pre>
1542 </div>
1543 <hr>
1544 <div class="refsect2">
1545 <a name="gnutls-pkcs12-bag-t"></a><h3>gnutls_pkcs12_bag_t</h3>
1546 <pre class="programlisting">typedef struct gnutls_pkcs12_bag_int *gnutls_pkcs12_bag_t;
1547 </pre>
1548 </div>
1549 <hr>
1550 <div class="refsect2">
1551 <a name="gnutls-pkcs12-flags-t"></a><h3>enum gnutls_pkcs12_flags_t</h3>
1552 <div class="refsect3">
1553 <a name="gnutls-pkcs12-flags-t.members"></a><h4>Members</h4>
1554 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1555 <colgroup>
1556 <col width="300px" class="enum_members_name">
1557 <col class="enum_members_description">
1558 <col width="200px" class="enum_members_annotations">
1559 </colgroup>
1560 <tbody><tr>
1561 <td class="enum_member_name"><p><a name="GNUTLS-PKCS12-USE-PBMAC1:CAPS"></a>GNUTLS_PKCS12_USE_PBMAC1</p></td>
1562 <td> </td>
1563 <td> </td>
1564 </tr></tbody>
1565 </table></div>
1566 </div>
1567 </div>
1568 <hr>
1569 <div class="refsect2">
1570 <a name="GNUTLS-PKCS12-SP-INCLUDE-SELF-SIGNED:CAPS"></a><h3>GNUTLS_PKCS12_SP_INCLUDE_SELF_SIGNED</h3>
1571 <pre class="programlisting">#define GNUTLS_PKCS12_SP_INCLUDE_SELF_SIGNED 1
1572 </pre>
1573 </div>
1574 <hr>
1575 <div class="refsect2">
1576 <a name="gnutls-pkcs12-bag-type-t"></a><h3>enum gnutls_pkcs12_bag_type_t</h3>
1577 <p>Enumeration of different PKCS 12 bag types.</p>
1578 <div class="refsect3">
1579 <a name="gnutls-pkcs12-bag-type-t.members"></a><h4>Members</h4>
1580 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1581 <colgroup>
1582 <col width="300px" class="enum_members_name">
1583 <col class="enum_members_description">
1584 <col width="200px" class="enum_members_annotations">
1585 </colgroup>
1586 <tbody>
1587 <tr>
1588 <td class="enum_member_name"><p><a name="GNUTLS-BAG-EMPTY:CAPS"></a>GNUTLS_BAG_EMPTY</p></td>
1589 <td class="enum_member_description">
1590 <p>Empty PKCS-12 bag.</p>
1591 </td>
1592 <td class="enum_member_annotations"> </td>
1593 </tr>
1594 <tr>
1595 <td class="enum_member_name"><p><a name="GNUTLS-BAG-PKCS8-ENCRYPTED-KEY:CAPS"></a>GNUTLS_BAG_PKCS8_ENCRYPTED_KEY</p></td>
1596 <td class="enum_member_description">
1597 <p>PKCS-12 bag with PKCS-8 encrypted key.</p>
1598 </td>
1599 <td class="enum_member_annotations"> </td>
1600 </tr>
1601 <tr>
1602 <td class="enum_member_name"><p><a name="GNUTLS-BAG-PKCS8-KEY:CAPS"></a>GNUTLS_BAG_PKCS8_KEY</p></td>
1603 <td class="enum_member_description">
1604 <p>PKCS-12 bag with PKCS-8 key.</p>
1605 </td>
1606 <td class="enum_member_annotations"> </td>
1607 </tr>
1608 <tr>
1609 <td class="enum_member_name"><p><a name="GNUTLS-BAG-CERTIFICATE:CAPS"></a>GNUTLS_BAG_CERTIFICATE</p></td>
1610 <td class="enum_member_description">
1611 <p>PKCS-12 bag with certificate.</p>
1612 </td>
1613 <td class="enum_member_annotations"> </td>
1614 </tr>
1615 <tr>
1616 <td class="enum_member_name"><p><a name="GNUTLS-BAG-CRL:CAPS"></a>GNUTLS_BAG_CRL</p></td>
1617 <td class="enum_member_description">
1618 <p>PKCS-12 bag with CRL.</p>
1619 </td>
1620 <td class="enum_member_annotations"> </td>
1621 </tr>
1622 <tr>
1623 <td class="enum_member_name"><p><a name="GNUTLS-BAG-SECRET:CAPS"></a>GNUTLS_BAG_SECRET</p></td>
1624 <td class="enum_member_description">
1625 <p>PKCS-12 bag with secret PKCS-9 keys.</p>
1626 </td>
1627 <td class="enum_member_annotations"> </td>
1628 </tr>
1629 <tr>
1630 <td class="enum_member_name"><p><a name="GNUTLS-BAG-ENCRYPTED:CAPS"></a>GNUTLS_BAG_ENCRYPTED</p></td>
1631 <td class="enum_member_description">
1632 <p>Encrypted PKCS-12 bag.</p>
1633 </td>
1634 <td class="enum_member_annotations"> </td>
1635 </tr>
1636 <tr>
1637 <td class="enum_member_name"><p><a name="GNUTLS-BAG-UNKNOWN:CAPS"></a>GNUTLS_BAG_UNKNOWN</p></td>
1638 <td class="enum_member_description">
1639 <p>Unknown PKCS-12 bag.</p>
1640 </td>
1641 <td class="enum_member_annotations"> </td>
1642 </tr>
1643 </tbody>
1644 </table></div>
1645 </div>
1646 </div>
1647 <hr>
1648 <div class="refsect2">
1649 <a name="gnutls-pkcs12-bag-int"></a><h3>gnutls_pkcs12_bag_int</h3>
1650 <pre class="programlisting">typedef struct {
1651 struct bag_element element[MAX_BAG_ELEMENTS];
1652 unsigned bag_elements;
1653 } gnutls_pkcs12_bag_int;
1654 </pre>
1655 </div>
1656 <hr>
1657 <div class="refsect2">
1658 <a name="gnutls-pkcs12-int"></a><h3>gnutls_pkcs12_int</h3>
1659 <pre class="programlisting">typedef struct {
1660 asn1_node pkcs12;
1661 unsigned expanded;
1662 } gnutls_pkcs12_int;
1663 </pre>
1664 </div>
1665 </div>
1666 </div>
1667 <div class="footer">
1668 <hr>Generated by GTK-Doc V1.34.0</div>
1669 </body>
1670 </html>