Revert "Merge branch 'upstream' into tizen"
[platform/upstream/gnutls.git] / doc / x509-api.texi
1
2 @subheading gnutls_certificate_set_trust_list
3 @anchor{gnutls_certificate_set_trust_list}
4 @deftypefun {void} {gnutls_certificate_set_trust_list} (gnutls_certificate_credentials_t @var{res}, gnutls_x509_trust_list_t @var{tlist}, unsigned @var{flags})
5 @var{res}: is a @code{gnutls_certificate_credentials_t}  structure.
6
7 @var{tlist}: is a @code{gnutls_x509_trust_list_t}  structure
8
9 @var{flags}: must be zero
10
11 This function sets a trust list in the gnutls_certificate_credentials_t structure. 
12
13 Note that the  @code{tlist} will become part of the credentials 
14 structure and must not be deallocated. It will be automatically deallocated 
15 when the  @code{res} structure is deinitialized.
16
17 @strong{Returns:} @code{GNUTLS_E_SUCCESS}  (0) on success, or a negative error code.
18
19 @strong{Since:} 3.2.2
20 @end deftypefun
21
22 @subheading gnutls_pkcs7_deinit
23 @anchor{gnutls_pkcs7_deinit}
24 @deftypefun {void} {gnutls_pkcs7_deinit} (gnutls_pkcs7_t @var{pkcs7})
25 @var{pkcs7}: The structure to be initialized
26
27 This function will deinitialize a PKCS7 structure.
28 @end deftypefun
29
30 @subheading gnutls_pkcs7_delete_crl
31 @anchor{gnutls_pkcs7_delete_crl}
32 @deftypefun {int} {gnutls_pkcs7_delete_crl} (gnutls_pkcs7_t @var{pkcs7}, int @var{indx})
33 @var{pkcs7}: should contain a @code{gnutls_pkcs7_t}  structure
34
35 @var{indx}: the index of the crl to delete
36
37 This function will delete a crl from a PKCS7 or RFC2630 crl set.
38 Index starts from 0. Returns 0 on success.
39
40 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
41 negative error value.
42 @end deftypefun
43
44 @subheading gnutls_pkcs7_delete_crt
45 @anchor{gnutls_pkcs7_delete_crt}
46 @deftypefun {int} {gnutls_pkcs7_delete_crt} (gnutls_pkcs7_t @var{pkcs7}, int @var{indx})
47 @var{pkcs7}: should contain a gnutls_pkcs7_t structure
48
49 @var{indx}: the index of the certificate to delete
50
51 This function will delete a certificate from a PKCS7 or RFC2630
52 certificate set.  Index starts from 0. Returns 0 on success.
53
54 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
55 negative error value.
56 @end deftypefun
57
58 @subheading gnutls_pkcs7_export
59 @anchor{gnutls_pkcs7_export}
60 @deftypefun {int} {gnutls_pkcs7_export} (gnutls_pkcs7_t @var{pkcs7}, gnutls_x509_crt_fmt_t @var{format}, void * @var{output_data}, size_t * @var{output_data_size})
61 @var{pkcs7}: Holds the pkcs7 structure
62
63 @var{format}: the format of output params. One of PEM or DER.
64
65 @var{output_data}: will contain a structure PEM or DER encoded
66
67 @var{output_data_size}: holds the size of output_data (and will be
68 replaced by the actual size of parameters)
69
70 This function will export the pkcs7 structure to DER or PEM format.
71
72 If the buffer provided is not long enough to hold the output, then
73 * @code{output_data_size} is updated and @code{GNUTLS_E_SHORT_MEMORY_BUFFER} 
74 will be returned.
75
76 If the structure is PEM encoded, it will have a header
77 of "BEGIN PKCS7".
78
79 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
80 negative error value.
81 @end deftypefun
82
83 @subheading gnutls_pkcs7_export2
84 @anchor{gnutls_pkcs7_export2}
85 @deftypefun {int} {gnutls_pkcs7_export2} (gnutls_pkcs7_t @var{pkcs7}, gnutls_x509_crt_fmt_t @var{format}, gnutls_datum_t * @var{out})
86 @var{pkcs7}: Holds the pkcs7 structure
87
88 @var{format}: the format of output params. One of PEM or DER.
89
90 @var{out}: will contain a structure PEM or DER encoded
91
92 This function will export the pkcs7 structure to DER or PEM format.
93
94 The output buffer is allocated using @code{gnutls_malloc()} .
95
96 If the structure is PEM encoded, it will have a header
97 of "BEGIN PKCS7".
98
99 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
100 negative error value.
101
102 @strong{Since:} 3.1.3
103 @end deftypefun
104
105 @subheading gnutls_pkcs7_get_crl_count
106 @anchor{gnutls_pkcs7_get_crl_count}
107 @deftypefun {int} {gnutls_pkcs7_get_crl_count} (gnutls_pkcs7_t @var{pkcs7})
108 @var{pkcs7}: should contain a gnutls_pkcs7_t structure
109
110 This function will return the number of certifcates in the PKCS7
111 or RFC2630 crl set.
112
113 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
114 negative error value.
115 @end deftypefun
116
117 @subheading gnutls_pkcs7_get_crl_raw
118 @anchor{gnutls_pkcs7_get_crl_raw}
119 @deftypefun {int} {gnutls_pkcs7_get_crl_raw} (gnutls_pkcs7_t @var{pkcs7}, int @var{indx}, void * @var{crl}, size_t * @var{crl_size})
120 @var{pkcs7}: should contain a @code{gnutls_pkcs7_t}  structure
121
122 @var{indx}: contains the index of the crl to extract
123
124 @var{crl}: the contents of the crl will be copied there (may be null)
125
126 @var{crl_size}: should hold the size of the crl
127
128 This function will return a crl of the PKCS7 or RFC2630 crl set.
129
130 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
131 negative error value.  If the provided buffer is not long enough,
132 then  @code{crl_size} is updated and @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  is
133 returned.  After the last crl has been read
134 @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  will be returned.
135 @end deftypefun
136
137 @subheading gnutls_pkcs7_get_crt_count
138 @anchor{gnutls_pkcs7_get_crt_count}
139 @deftypefun {int} {gnutls_pkcs7_get_crt_count} (gnutls_pkcs7_t @var{pkcs7})
140 @var{pkcs7}: should contain a @code{gnutls_pkcs7_t}  structure
141
142 This function will return the number of certifcates in the PKCS7
143 or RFC2630 certificate set.
144
145 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
146 negative error value.
147 @end deftypefun
148
149 @subheading gnutls_pkcs7_get_crt_raw
150 @anchor{gnutls_pkcs7_get_crt_raw}
151 @deftypefun {int} {gnutls_pkcs7_get_crt_raw} (gnutls_pkcs7_t @var{pkcs7}, int @var{indx}, void * @var{certificate}, size_t * @var{certificate_size})
152 @var{pkcs7}: should contain a gnutls_pkcs7_t structure
153
154 @var{indx}: contains the index of the certificate to extract
155
156 @var{certificate}: the contents of the certificate will be copied
157 there (may be null)
158
159 @var{certificate_size}: should hold the size of the certificate
160
161 This function will return a certificate of the PKCS7 or RFC2630
162 certificate set.
163
164 After the last certificate has been read
165 @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  will be returned.
166
167 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
168 negative error value.  If the provided buffer is not long enough,
169 then  @code{certificate_size} is updated and
170 @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  is returned.
171 @end deftypefun
172
173 @subheading gnutls_pkcs7_import
174 @anchor{gnutls_pkcs7_import}
175 @deftypefun {int} {gnutls_pkcs7_import} (gnutls_pkcs7_t @var{pkcs7}, const gnutls_datum_t * @var{data}, gnutls_x509_crt_fmt_t @var{format})
176 @var{pkcs7}: The structure to store the parsed PKCS7.
177
178 @var{data}: The DER or PEM encoded PKCS7.
179
180 @var{format}: One of DER or PEM
181
182 This function will convert the given DER or PEM encoded PKCS7 to
183 the native @code{gnutls_pkcs7_t}  format.  The output will be stored in
184  @code{pkcs7} .
185
186 If the PKCS7 is PEM encoded it should have a header of "PKCS7".
187
188 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
189 negative error value.
190 @end deftypefun
191
192 @subheading gnutls_pkcs7_init
193 @anchor{gnutls_pkcs7_init}
194 @deftypefun {int} {gnutls_pkcs7_init} (gnutls_pkcs7_t * @var{pkcs7})
195 @var{pkcs7}: The structure to be initialized
196
197 This function will initialize a PKCS7 structure. PKCS7 structures
198 usually contain lists of X.509 Certificates and X.509 Certificate
199 revocation lists.
200
201 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
202 negative error value.
203 @end deftypefun
204
205 @subheading gnutls_pkcs7_set_crl
206 @anchor{gnutls_pkcs7_set_crl}
207 @deftypefun {int} {gnutls_pkcs7_set_crl} (gnutls_pkcs7_t @var{pkcs7}, gnutls_x509_crl_t @var{crl})
208 @var{pkcs7}: should contain a @code{gnutls_pkcs7_t}  structure
209
210 @var{crl}: the DER encoded crl to be added
211
212 This function will add a parsed CRL to the PKCS7 or RFC2630 crl
213 set.
214
215 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
216 negative error value.
217 @end deftypefun
218
219 @subheading gnutls_pkcs7_set_crl_raw
220 @anchor{gnutls_pkcs7_set_crl_raw}
221 @deftypefun {int} {gnutls_pkcs7_set_crl_raw} (gnutls_pkcs7_t @var{pkcs7}, const gnutls_datum_t * @var{crl})
222 @var{pkcs7}: should contain a @code{gnutls_pkcs7_t}  structure
223
224 @var{crl}: the DER encoded crl to be added
225
226 This function will add a crl to the PKCS7 or RFC2630 crl set.
227
228 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
229 negative error value.
230 @end deftypefun
231
232 @subheading gnutls_pkcs7_set_crt
233 @anchor{gnutls_pkcs7_set_crt}
234 @deftypefun {int} {gnutls_pkcs7_set_crt} (gnutls_pkcs7_t @var{pkcs7}, gnutls_x509_crt_t @var{crt})
235 @var{pkcs7}: should contain a @code{gnutls_pkcs7_t}  structure
236
237 @var{crt}: the certificate to be copied.
238
239 This function will add a parsed certificate to the PKCS7 or
240 RFC2630 certificate set.  This is a wrapper function over
241 @code{gnutls_pkcs7_set_crt_raw()}  .
242
243 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
244 negative error value.
245 @end deftypefun
246
247 @subheading gnutls_pkcs7_set_crt_raw
248 @anchor{gnutls_pkcs7_set_crt_raw}
249 @deftypefun {int} {gnutls_pkcs7_set_crt_raw} (gnutls_pkcs7_t @var{pkcs7}, const gnutls_datum_t * @var{crt})
250 @var{pkcs7}: should contain a @code{gnutls_pkcs7_t}  structure
251
252 @var{crt}: the DER encoded certificate to be added
253
254 This function will add a certificate to the PKCS7 or RFC2630
255 certificate set.
256
257 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
258 negative error value.
259 @end deftypefun
260
261 @subheading gnutls_subject_alt_names_deinit
262 @anchor{gnutls_subject_alt_names_deinit}
263 @deftypefun {void} {gnutls_subject_alt_names_deinit} (gnutls_subject_alt_names_t @var{sans})
264 @var{sans}: The alternative names structure
265
266 This function will deinitialize an alternative names structure.
267
268 @strong{Since:} 3.3.0
269 @end deftypefun
270
271 @subheading gnutls_subject_alt_names_get
272 @anchor{gnutls_subject_alt_names_get}
273 @deftypefun {int} {gnutls_subject_alt_names_get} (gnutls_subject_alt_names_t @var{sans}, unsigned int @var{seq}, unsigned int * @var{san_type}, gnutls_datum_t * @var{san}, gnutls_datum_t * @var{othername_oid})
274 @var{sans}: The alternative names structure
275
276 @var{seq}: The index of the name to get
277
278 @var{san_type}: Will hold the type of the name (of @code{gnutls_subject_alt_names_t} )
279
280 @var{san}: The alternative name data (should be treated as constant)
281
282 @var{othername_oid}: The object identifier if  @code{san_type} is @code{GNUTLS_SAN_OTHERNAME}  (should be treated as constant)
283
284 This function will return a specific alternative name as stored in
285 the  @code{sans} structure. The returned values should be treated as constant
286 and valid for the lifetime of  @code{sans} .
287
288 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
289 if the index is out of bounds, otherwise a negative error value.
290
291 @strong{Since:} 3.3.0
292 @end deftypefun
293
294 @subheading gnutls_subject_alt_names_init
295 @anchor{gnutls_subject_alt_names_init}
296 @deftypefun {int} {gnutls_subject_alt_names_init} (gnutls_subject_alt_names_t * @var{sans})
297 @var{sans}: The alternative names structure
298
299 This function will initialize an alternative names structure.
300
301 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a negative error value.
302
303 @strong{Since:} 3.3.0
304 @end deftypefun
305
306 @subheading gnutls_subject_alt_names_set
307 @anchor{gnutls_subject_alt_names_set}
308 @deftypefun {int} {gnutls_subject_alt_names_set} (gnutls_subject_alt_names_t @var{sans}, unsigned int @var{san_type}, const gnutls_datum_t * @var{san}, const char * @var{othername_oid})
309 @var{sans}: The alternative names structure
310
311 @var{san_type}: The type of the name (of @code{gnutls_subject_alt_names_t} )
312
313 @var{san}: The alternative name data
314
315 @var{othername_oid}: The object identifier if  @code{san_type} is @code{GNUTLS_SAN_OTHERNAME} 
316
317 This function will store the specified alternative name in
318 the  @code{sans} structure.
319
320 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0), otherwise a negative error value.
321
322 @strong{Since:} 3.3.0
323 @end deftypefun
324
325 @subheading gnutls_x509_aia_deinit
326 @anchor{gnutls_x509_aia_deinit}
327 @deftypefun {void} {gnutls_x509_aia_deinit} (gnutls_x509_aia_t @var{aia})
328 @var{aia}: The authority info access structure
329
330 This function will deinitialize a CRL distribution points structure.
331
332 @strong{Since:} 3.3.0
333 @end deftypefun
334
335 @subheading gnutls_x509_aia_get
336 @anchor{gnutls_x509_aia_get}
337 @deftypefun {int} {gnutls_x509_aia_get} (gnutls_x509_aia_t @var{aia}, unsigned int @var{seq}, gnutls_datum_t * @var{oid}, unsigned * @var{san_type}, gnutls_datum_t * @var{san})
338 @var{aia}: The authority info access structure
339
340 @var{seq}: specifies the sequence number of the access descriptor (0 for the first one, 1 for the second etc.)
341
342 @var{oid}: the type of available data; to be treated as constant.
343
344 @var{san_type}: Will hold the type of the name of @code{gnutls_subject_alt_names_t}  (may be null).
345
346 @var{san}: the access location name; to be treated as constant (may be null).
347
348 This function reads from the Authority Information Access structure.
349
350 The  @code{seq} input parameter is used to indicate which member of the
351 sequence the caller is interested in.  The first member is 0, the
352 second member 1 and so on.  When the  @code{seq} value is out of bounds,
353 @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  is returned.
354
355 Typically  @code{oid} is @code{GNUTLS_OID_AD_CAISSUERS}  or @code{GNUTLS_OID_AD_OCSP} .
356
357 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a negative error value.
358
359 @strong{Since:} 3.3.0
360 @end deftypefun
361
362 @subheading gnutls_x509_aia_init
363 @anchor{gnutls_x509_aia_init}
364 @deftypefun {int} {gnutls_x509_aia_init} (gnutls_x509_aia_t * @var{aia})
365 @var{aia}: The authority info access structure
366
367 This function will initialize a CRL distribution points structure.
368
369 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a negative error value.
370
371 @strong{Since:} 3.3.0
372 @end deftypefun
373
374 @subheading gnutls_x509_aia_set
375 @anchor{gnutls_x509_aia_set}
376 @deftypefun {int} {gnutls_x509_aia_set} (gnutls_x509_aia_t @var{aia}, const char * @var{oid}, unsigned @var{san_type}, const gnutls_datum_t * @var{san})
377 @var{aia}: The authority info access structure
378
379 @var{oid}: the type of data.
380
381 @var{san_type}: The type of the name (of @code{gnutls_subject_alt_names_t} )
382
383 @var{san}: The alternative name data
384
385 This function will store the specified alternative name in
386 the  @code{aia} structure. 
387
388 Typically the value for  @code{oid} should be @code{GNUTLS_OID_AD_OCSP} , or
389 @code{GNUTLS_OID_AD_CAISSUERS} .
390
391 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0), otherwise a negative error value.
392
393 @strong{Since:} 3.3.0
394 @end deftypefun
395
396 @subheading gnutls_x509_aki_deinit
397 @anchor{gnutls_x509_aki_deinit}
398 @deftypefun {void} {gnutls_x509_aki_deinit} (gnutls_x509_aki_t @var{aki})
399 @var{aki}: The authority key identifier structure
400
401 This function will deinitialize an authority key identifier structure.
402
403 @strong{Since:} 3.3.0
404 @end deftypefun
405
406 @subheading gnutls_x509_aki_get_cert_issuer
407 @anchor{gnutls_x509_aki_get_cert_issuer}
408 @deftypefun {int} {gnutls_x509_aki_get_cert_issuer} (gnutls_x509_aki_t @var{aki}, unsigned int @var{seq}, unsigned int * @var{san_type}, gnutls_datum_t * @var{san}, gnutls_datum_t * @var{othername_oid}, gnutls_datum_t * @var{serial})
409 @var{aki}: The authority key ID structure
410
411 @var{seq}: The index of the name to get
412
413 @var{san_type}: Will hold the type of the name (of @code{gnutls_subject_alt_names_t} ), may be null
414
415 @var{san}: The alternative name data (may be null and should be treated as constant)
416
417 @var{othername_oid}: The object identifier if  @code{san_type} is @code{GNUTLS_SAN_OTHERNAME}  (should be treated as constant)
418
419 @var{serial}: The authorityCertSerialNumber number (may be null)
420
421 This function will return a specific authorityCertIssuer name as stored in
422 the  @code{aki} structure, as well as the authorityCertSerialNumber.
423
424 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
425 if the index is out of bounds, otherwise a negative error value.
426
427 @strong{Since:} 3.3.0
428 @end deftypefun
429
430 @subheading gnutls_x509_aki_get_id
431 @anchor{gnutls_x509_aki_get_id}
432 @deftypefun {int} {gnutls_x509_aki_get_id} (gnutls_x509_aki_t @var{aki}, gnutls_datum_t * @var{id})
433 @var{aki}: The authority key ID structure
434
435 @var{id}: Will hold the identifier
436
437 This function will return the key identifier as stored in
438 the  @code{aki} structure.
439
440 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
441 if the index is out of bounds, otherwise a negative error value.
442
443 @strong{Since:} 3.3.0
444 @end deftypefun
445
446 @subheading gnutls_x509_aki_init
447 @anchor{gnutls_x509_aki_init}
448 @deftypefun {int} {gnutls_x509_aki_init} (gnutls_x509_aki_t * @var{aki})
449 @var{aki}: The authority key ID structure
450
451 This function will initialize an authority key ID structure.
452
453 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a negative error value.
454
455 @strong{Since:} 3.3.0
456 @end deftypefun
457
458 @subheading gnutls_x509_aki_set_cert_issuer
459 @anchor{gnutls_x509_aki_set_cert_issuer}
460 @deftypefun {int} {gnutls_x509_aki_set_cert_issuer} (gnutls_x509_aki_t @var{aki}, unsigned int @var{san_type}, const gnutls_datum_t * @var{san}, const char * @var{othername_oid}, const gnutls_datum_t * @var{serial})
461 @var{aki}: The authority key ID structure
462
463 @var{san_type}: the type of the name (of @code{gnutls_subject_alt_names_t} ), may be null
464
465 @var{san}: The alternative name data
466
467 @var{othername_oid}: The object identifier if  @code{san_type} is @code{GNUTLS_SAN_OTHERNAME} 
468
469 @var{serial}: The authorityCertSerialNumber number (may be null)
470
471 This function will set the authorityCertIssuer name and the authorityCertSerialNumber 
472 to be stored in the  @code{aki} structure. When storing multiple names, the serial
473 should be set on the first call, and subsequent calls should use a @code{NULL}  serial.
474
475 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a negative error value.
476
477 @strong{Since:} 3.3.0
478 @end deftypefun
479
480 @subheading gnutls_x509_aki_set_id
481 @anchor{gnutls_x509_aki_set_id}
482 @deftypefun {int} {gnutls_x509_aki_set_id} (gnutls_x509_aki_t @var{aki}, const gnutls_datum_t * @var{id})
483 @var{aki}: The authority key ID structure
484
485 @var{id}: the key identifier
486
487 This function will set the keyIdentifier to be stored in the  @code{aki} structure.
488
489 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a negative error value.
490
491 @strong{Since:} 3.3.0
492 @end deftypefun
493
494 @subheading gnutls_x509_crl_check_issuer
495 @anchor{gnutls_x509_crl_check_issuer}
496 @deftypefun {int} {gnutls_x509_crl_check_issuer} (gnutls_x509_crl_t @var{crl}, gnutls_x509_crt_t @var{issuer})
497 @var{crl}: is the CRL to be checked
498
499 @var{issuer}: is the certificate of a possible issuer
500
501 This function will check if the given CRL was issued by the given
502 issuer certificate.  
503
504 @strong{Returns:} true (1) if the given CRL was issued by the given issuer, 
505 and false (0) if not.
506 @end deftypefun
507
508 @subheading gnutls_x509_crl_deinit
509 @anchor{gnutls_x509_crl_deinit}
510 @deftypefun {void} {gnutls_x509_crl_deinit} (gnutls_x509_crl_t @var{crl})
511 @var{crl}: The structure to be deinitialized
512
513 This function will deinitialize a CRL structure.
514 @end deftypefun
515
516 @subheading gnutls_x509_crl_dist_points_deinit
517 @anchor{gnutls_x509_crl_dist_points_deinit}
518 @deftypefun {void} {gnutls_x509_crl_dist_points_deinit} (gnutls_x509_crl_dist_points_t @var{cdp})
519 @var{cdp}: The CRL distribution points structure
520
521 This function will deinitialize a CRL distribution points structure.
522
523 @strong{Since:} 3.3.0
524 @end deftypefun
525
526 @subheading gnutls_x509_crl_dist_points_get
527 @anchor{gnutls_x509_crl_dist_points_get}
528 @deftypefun {int} {gnutls_x509_crl_dist_points_get} (gnutls_x509_crl_dist_points_t @var{cdp}, unsigned int @var{seq}, unsigned int * @var{type}, gnutls_datum_t * @var{san}, unsigned int * @var{reasons})
529 @var{cdp}: The CRL distribution points structure
530
531 @var{seq}: specifies the sequence number of the distribution point (0 for the first one, 1 for the second etc.)
532
533 @var{type}: The name type of the corresponding name (gnutls_x509_subject_alt_name_t)
534
535 @var{san}: The distribution point names (to be treated as constant)
536
537 @var{reasons}: Revocation reasons. An ORed sequence of flags from @code{gnutls_x509_crl_reason_flags_t} .
538
539 This function retrieves the individual CRL distribution points (2.5.29.31),
540 contained in provided structure. 
541
542 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
543 if the index is out of bounds, otherwise a negative error value.
544 @end deftypefun
545
546 @subheading gnutls_x509_crl_dist_points_init
547 @anchor{gnutls_x509_crl_dist_points_init}
548 @deftypefun {int} {gnutls_x509_crl_dist_points_init} (gnutls_x509_crl_dist_points_t * @var{cdp})
549 @var{cdp}: The CRL distribution points structure
550
551 This function will initialize a CRL distribution points structure.
552
553 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a negative error value.
554
555 @strong{Since:} 3.3.0
556 @end deftypefun
557
558 @subheading gnutls_x509_crl_dist_points_set
559 @anchor{gnutls_x509_crl_dist_points_set}
560 @deftypefun {int} {gnutls_x509_crl_dist_points_set} (gnutls_x509_crl_dist_points_t @var{cdp}, gnutls_x509_subject_alt_name_t @var{type}, const gnutls_datum_t * @var{san}, unsigned int @var{reasons})
561 @var{cdp}: The CRL distribution points structure
562
563 @var{type}: The type of the name (of @code{gnutls_subject_alt_names_t} )
564
565 @var{san}: The point name data
566
567 @var{reasons}: Revocation reasons. An ORed sequence of flags from @code{gnutls_x509_crl_reason_flags_t} .
568
569 This function will store the specified CRL distibution point value
570 the  @code{cdp} structure.
571
572 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0), otherwise a negative error value.
573
574 @strong{Since:} 3.3.0
575 @end deftypefun
576
577 @subheading gnutls_x509_crl_export
578 @anchor{gnutls_x509_crl_export}
579 @deftypefun {int} {gnutls_x509_crl_export} (gnutls_x509_crl_t @var{crl}, gnutls_x509_crt_fmt_t @var{format}, void * @var{output_data}, size_t * @var{output_data_size})
580 @var{crl}: Holds the revocation list
581
582 @var{format}: the format of output params. One of PEM or DER.
583
584 @var{output_data}: will contain a private key PEM or DER encoded
585
586 @var{output_data_size}: holds the size of output_data (and will
587 be replaced by the actual size of parameters)
588
589 This function will export the revocation list to DER or PEM format.
590
591 If the buffer provided is not long enough to hold the output, then
592 @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  will be returned.
593
594 If the structure is PEM encoded, it will have a header
595 of "BEGIN X509 CRL".
596
597 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
598 negative error value. and a negative error code on failure.
599 @end deftypefun
600
601 @subheading gnutls_x509_crl_export2
602 @anchor{gnutls_x509_crl_export2}
603 @deftypefun {int} {gnutls_x509_crl_export2} (gnutls_x509_crl_t @var{crl}, gnutls_x509_crt_fmt_t @var{format}, gnutls_datum_t * @var{out})
604 @var{crl}: Holds the revocation list
605
606 @var{format}: the format of output params. One of PEM or DER.
607
608 @var{out}: will contain a private key PEM or DER encoded
609
610 This function will export the revocation list to DER or PEM format.
611
612 The output buffer is allocated using @code{gnutls_malloc()} .
613
614 If the structure is PEM encoded, it will have a header
615 of "BEGIN X509 CRL".
616
617 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
618 negative error value. and a negative error code on failure.
619
620 Since 3.1.3
621 @end deftypefun
622
623 @subheading gnutls_x509_crl_get_authority_key_gn_serial
624 @anchor{gnutls_x509_crl_get_authority_key_gn_serial}
625 @deftypefun {int} {gnutls_x509_crl_get_authority_key_gn_serial} (gnutls_x509_crl_t @var{crl}, unsigned int @var{seq}, void * @var{alt}, size_t * @var{alt_size}, unsigned int * @var{alt_type}, void * @var{serial}, size_t * @var{serial_size}, unsigned int * @var{critical})
626 @var{crl}: should contain a @code{gnutls_x509_crl_t}  structure
627
628 @var{seq}: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.)
629
630 @var{alt}: is the place where the alternative name will be copied to
631
632 @var{alt_size}: holds the size of alt.
633
634 @var{alt_type}: holds the type of the alternative name (one of gnutls_x509_subject_alt_name_t).
635
636 @var{serial}: buffer to store the serial number (may be null)
637
638 @var{serial_size}: Holds the size of the serial field (may be null)
639
640 @var{critical}: will be non-zero if the extension is marked as critical (may be null)
641
642 This function will return the X.509 authority key
643 identifier when stored as a general name (authorityCertIssuer) 
644 and serial number.
645
646 Because more than one general names might be stored
647  @code{seq} can be used as a counter to request them all until 
648 @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  is returned.
649
650 @strong{Returns:} Returns 0 on success, or an error code.
651
652 @strong{Since:} 3.0
653 @end deftypefun
654
655 @subheading gnutls_x509_crl_get_authority_key_id
656 @anchor{gnutls_x509_crl_get_authority_key_id}
657 @deftypefun {int} {gnutls_x509_crl_get_authority_key_id} (gnutls_x509_crl_t @var{crl}, void * @var{id}, size_t * @var{id_size}, unsigned int * @var{critical})
658 @var{crl}: should contain a @code{gnutls_x509_crl_t}  structure
659
660 @var{id}: The place where the identifier will be copied
661
662 @var{id_size}: Holds the size of the result field.
663
664 @var{critical}: will be non-zero if the extension is marked as critical
665 (may be null)
666
667 This function will return the CRL authority's key identifier.  This
668 is obtained by the X.509 Authority Key identifier extension field
669 (2.5.29.35).  Note that this function 
670 only returns the keyIdentifier field of the extension and
671 @code{GNUTLS_E_X509_UNSUPPORTED_EXTENSION} , if the extension contains
672 the name and serial number of the certificate. In that case
673 @code{gnutls_x509_crl_get_authority_key_gn_serial()}  may be used.
674
675 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
676 negative error code in case of an error.
677
678 @strong{Since:} 2.8.0
679 @end deftypefun
680
681 @subheading gnutls_x509_crl_get_crt_count
682 @anchor{gnutls_x509_crl_get_crt_count}
683 @deftypefun {int} {gnutls_x509_crl_get_crt_count} (gnutls_x509_crl_t @var{crl})
684 @var{crl}: should contain a @code{gnutls_x509_crl_t}  structure
685
686 This function will return the number of revoked certificates in the
687 given CRL.
688
689 @strong{Returns:} number of certificates, a negative error code on failure.
690 @end deftypefun
691
692 @subheading gnutls_x509_crl_get_crt_serial
693 @anchor{gnutls_x509_crl_get_crt_serial}
694 @deftypefun {int} {gnutls_x509_crl_get_crt_serial} (gnutls_x509_crl_t @var{crl}, int @var{indx}, unsigned char * @var{serial}, size_t * @var{serial_size}, time_t * @var{t})
695 @var{crl}: should contain a @code{gnutls_x509_crl_t}  structure
696
697 @var{indx}: the index of the certificate to extract (starting from 0)
698
699 @var{serial}: where the serial number will be copied
700
701 @var{serial_size}: initially holds the size of serial
702
703 @var{t}: if non null, will hold the time this certificate was revoked
704
705 This function will retrieve the serial number of the specified, by
706 the index, revoked certificate.
707
708 Note that this function will have performance issues in large sequences
709 of revoked certificates. In that case use @code{gnutls_x509_crl_iter_crt_serial()} .
710
711 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
712 negative error value. and a negative error code on error.
713 @end deftypefun
714
715 @subheading gnutls_x509_crl_get_dn_oid
716 @anchor{gnutls_x509_crl_get_dn_oid}
717 @deftypefun {int} {gnutls_x509_crl_get_dn_oid} (gnutls_x509_crl_t @var{crl}, int @var{indx}, void * @var{oid}, size_t * @var{sizeof_oid})
718 @var{crl}: should contain a gnutls_x509_crl_t structure
719
720 @var{indx}: Specifies which DN OID to send. Use (0) to get the first one.
721
722 @var{oid}: a pointer to a structure to hold the name (may be null)
723
724 @var{sizeof_oid}: initially holds the size of 'oid'
725
726 This function will extract the requested OID of the name of the CRL
727 issuer, specified by the given index.
728
729 If oid is null then only the size will be filled.
730
731 @strong{Returns:} @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  if the provided buffer is
732 not long enough, and in that case the sizeof_oid will be updated
733 with the required size.  On success 0 is returned.
734 @end deftypefun
735
736 @subheading gnutls_x509_crl_get_extension_data
737 @anchor{gnutls_x509_crl_get_extension_data}
738 @deftypefun {int} {gnutls_x509_crl_get_extension_data} (gnutls_x509_crl_t @var{crl}, int @var{indx}, void * @var{data}, size_t * @var{sizeof_data})
739 @var{crl}: should contain a @code{gnutls_x509_crl_t}  structure
740
741 @var{indx}: Specifies which extension OID to send. Use (0) to get the first one.
742
743 @var{data}: a pointer to a structure to hold the data (may be null)
744
745 @var{sizeof_data}: initially holds the size of  @code{oid} 
746
747 This function will return the requested extension data in the CRL.
748 The extension data will be stored as a string in the provided
749 buffer.
750
751 Use @code{gnutls_x509_crl_get_extension_info()}  to extract the OID and
752 critical flag.  Use @code{gnutls_x509_crl_get_extension_info()}  instead,
753 if you want to get data indexed by the extension OID rather than
754 sequence.
755
756 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
757 negative error code in case of an error.  If your have reached the
758 last extension available @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
759 will be returned.
760
761 @strong{Since:} 2.8.0
762 @end deftypefun
763
764 @subheading gnutls_x509_crl_get_extension_data2
765 @anchor{gnutls_x509_crl_get_extension_data2}
766 @deftypefun {int} {gnutls_x509_crl_get_extension_data2} (gnutls_x509_crl_t @var{crl}, unsigned @var{indx}, gnutls_datum_t * @var{data})
767 @var{crl}: should contain a @code{gnutls_x509_crl_t}  structure
768
769 @var{indx}: Specifies which extension OID to read. Use (0) to get the first one.
770
771 @var{data}: will contain the extension DER-encoded data
772
773 This function will return the requested by the index extension data in the
774 certificate revocation list.  The extension data will be allocated using
775 @code{gnutls_malloc()} .
776
777 Use @code{gnutls_x509_crt_get_extension_info()}  to extract the OID.
778
779 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned,
780 otherwise a negative error code is returned.  If you have reached the
781 last extension available @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
782 will be returned.
783 @end deftypefun
784
785 @subheading gnutls_x509_crl_get_extension_info
786 @anchor{gnutls_x509_crl_get_extension_info}
787 @deftypefun {int} {gnutls_x509_crl_get_extension_info} (gnutls_x509_crl_t @var{crl}, int @var{indx}, void * @var{oid}, size_t * @var{sizeof_oid}, unsigned int * @var{critical})
788 @var{crl}: should contain a @code{gnutls_x509_crl_t}  structure
789
790 @var{indx}: Specifies which extension OID to send, use (0) to get the first one.
791
792 @var{oid}: a pointer to a structure to hold the OID
793
794 @var{sizeof_oid}: initially holds the maximum size of  @code{oid} , on return
795 holds actual size of  @code{oid} .
796
797 @var{critical}: output variable with critical flag, may be NULL.
798
799 This function will return the requested extension OID in the CRL,
800 and the critical flag for it.  The extension OID will be stored as
801 a string in the provided buffer.  Use
802 @code{gnutls_x509_crl_get_extension_data()}  to extract the data.
803
804 If the buffer provided is not long enough to hold the output, then
805 * @code{sizeof_oid} is updated and @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  will be
806 returned.
807
808 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
809 negative error code in case of an error.  If your have reached the
810 last extension available @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
811 will be returned.
812
813 @strong{Since:} 2.8.0
814 @end deftypefun
815
816 @subheading gnutls_x509_crl_get_extension_oid
817 @anchor{gnutls_x509_crl_get_extension_oid}
818 @deftypefun {int} {gnutls_x509_crl_get_extension_oid} (gnutls_x509_crl_t @var{crl}, int @var{indx}, void * @var{oid}, size_t * @var{sizeof_oid})
819 @var{crl}: should contain a @code{gnutls_x509_crl_t}  structure
820
821 @var{indx}: Specifies which extension OID to send, use (0) to get the first one.
822
823 @var{oid}: a pointer to a structure to hold the OID (may be null)
824
825 @var{sizeof_oid}: initially holds the size of  @code{oid} 
826
827 This function will return the requested extension OID in the CRL.
828 The extension OID will be stored as a string in the provided
829 buffer.
830
831 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
832 negative error code in case of an error.  If your have reached the
833 last extension available @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
834 will be returned.
835
836 @strong{Since:} 2.8.0
837 @end deftypefun
838
839 @subheading gnutls_x509_crl_get_issuer_dn
840 @anchor{gnutls_x509_crl_get_issuer_dn}
841 @deftypefun {int} {gnutls_x509_crl_get_issuer_dn} (const gnutls_x509_crl_t @var{crl}, char * @var{buf}, size_t * @var{sizeof_buf})
842 @var{crl}: should contain a gnutls_x509_crl_t structure
843
844 @var{buf}: a pointer to a structure to hold the peer's name (may be null)
845
846 @var{sizeof_buf}: initially holds the size of  @code{buf} 
847
848 This function will copy the name of the CRL issuer in the provided
849 buffer. The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as
850 described in RFC4514. The output string will be ASCII or UTF-8
851 encoded, depending on the certificate data.
852
853 If buf is @code{NULL}  then only the size will be filled.
854
855 @strong{Returns:} @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  if the provided buffer is
856 not long enough, and in that case the sizeof_buf will be updated
857 with the required size, and 0 on success.
858 @end deftypefun
859
860 @subheading gnutls_x509_crl_get_issuer_dn2
861 @anchor{gnutls_x509_crl_get_issuer_dn2}
862 @deftypefun {int} {gnutls_x509_crl_get_issuer_dn2} (gnutls_x509_crl_t @var{crl}, gnutls_datum_t * @var{dn})
863 @var{crl}: should contain a @code{gnutls_x509_crl_t}  structure
864
865 @var{dn}: a pointer to a structure to hold the name
866
867 This function will allocate buffer and copy the name of the CRL issuer.
868 The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as
869 described in RFC4514. The output string will be ASCII or UTF-8
870 encoded, depending on the certificate data.
871
872 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
873 negative error value. and a negative error code on error.
874
875 @strong{Since:} 3.1.10
876 @end deftypefun
877
878 @subheading gnutls_x509_crl_get_issuer_dn_by_oid
879 @anchor{gnutls_x509_crl_get_issuer_dn_by_oid}
880 @deftypefun {int} {gnutls_x509_crl_get_issuer_dn_by_oid} (gnutls_x509_crl_t @var{crl}, const char * @var{oid}, int @var{indx}, unsigned int @var{raw_flag}, void * @var{buf}, size_t * @var{sizeof_buf})
881 @var{crl}: should contain a gnutls_x509_crl_t structure
882
883 @var{oid}: holds an Object Identified in null terminated string
884
885 @var{indx}: In case multiple same OIDs exist in the RDN, this specifies which to send. Use (0) to get the first one.
886
887 @var{raw_flag}: If non-zero returns the raw DER data of the DN part.
888
889 @var{buf}: a pointer to a structure to hold the peer's name (may be null)
890
891 @var{sizeof_buf}: initially holds the size of  @code{buf} 
892
893 This function will extract the part of the name of the CRL issuer
894 specified by the given OID. The output will be encoded as described
895 in RFC4514. The output string will be ASCII or UTF-8 encoded,
896 depending on the certificate data.
897
898 Some helper macros with popular OIDs can be found in gnutls/x509.h
899 If raw flag is (0), this function will only return known OIDs as
900 text. Other OIDs will be DER encoded, as described in RFC4514 -- in
901 hex format with a '#' prefix.  You can check about known OIDs
902 using @code{gnutls_x509_dn_oid_known()} .
903
904 If buf is null then only the size will be filled.
905
906 @strong{Returns:} @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  if the provided buffer is
907 not long enough, and in that case the sizeof_buf will be updated
908 with the required size, and 0 on success.
909 @end deftypefun
910
911 @subheading gnutls_x509_crl_get_next_update
912 @anchor{gnutls_x509_crl_get_next_update}
913 @deftypefun {time_t} {gnutls_x509_crl_get_next_update} (gnutls_x509_crl_t @var{crl})
914 @var{crl}: should contain a @code{gnutls_x509_crl_t}  structure
915
916 This function will return the time the next CRL will be issued.
917 This field is optional in a CRL so it might be normal to get an
918 error instead.
919
920 @strong{Returns:} when the next CRL will be issued, or (time_t)-1 on error.
921 @end deftypefun
922
923 @subheading gnutls_x509_crl_get_number
924 @anchor{gnutls_x509_crl_get_number}
925 @deftypefun {int} {gnutls_x509_crl_get_number} (gnutls_x509_crl_t @var{crl}, void * @var{ret}, size_t * @var{ret_size}, unsigned int * @var{critical})
926 @var{crl}: should contain a @code{gnutls_x509_crl_t}  structure
927
928 @var{ret}: The place where the number will be copied
929
930 @var{ret_size}: Holds the size of the result field.
931
932 @var{critical}: will be non-zero if the extension is marked as critical
933 (may be null)
934
935 This function will return the CRL number extension.  This is
936 obtained by the CRL Number extension field (2.5.29.20).
937
938 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
939 negative error code in case of an error.
940
941 @strong{Since:} 2.8.0
942 @end deftypefun
943
944 @subheading gnutls_x509_crl_get_raw_issuer_dn
945 @anchor{gnutls_x509_crl_get_raw_issuer_dn}
946 @deftypefun {int} {gnutls_x509_crl_get_raw_issuer_dn} (gnutls_x509_crl_t @var{crl}, gnutls_datum_t * @var{dn})
947 @var{crl}: should contain a gnutls_x509_crl_t structure
948
949 @var{dn}: will hold the starting point of the DN
950
951 This function will return a pointer to the DER encoded DN structure
952 and the length.
953
954 @strong{Returns:} a negative error code on error, and (0) on success.
955
956 @strong{Since:} 2.12.0
957 @end deftypefun
958
959 @subheading gnutls_x509_crl_get_signature
960 @anchor{gnutls_x509_crl_get_signature}
961 @deftypefun {int} {gnutls_x509_crl_get_signature} (gnutls_x509_crl_t @var{crl}, char * @var{sig}, size_t * @var{sizeof_sig})
962 @var{crl}: should contain a gnutls_x509_crl_t structure
963
964 @var{sig}: a pointer where the signature part will be copied (may be null).
965
966 @var{sizeof_sig}: initially holds the size of  @code{sig} 
967
968 This function will extract the signature field of a CRL.
969
970 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
971 negative error value. and a negative error code on error.
972 @end deftypefun
973
974 @subheading gnutls_x509_crl_get_signature_algorithm
975 @anchor{gnutls_x509_crl_get_signature_algorithm}
976 @deftypefun {int} {gnutls_x509_crl_get_signature_algorithm} (gnutls_x509_crl_t @var{crl})
977 @var{crl}: should contain a @code{gnutls_x509_crl_t}  structure
978
979 This function will return a value of the @code{gnutls_sign_algorithm_t} 
980 enumeration that is the signature algorithm.
981
982 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
983 negative error value.
984 @end deftypefun
985
986 @subheading gnutls_x509_crl_get_this_update
987 @anchor{gnutls_x509_crl_get_this_update}
988 @deftypefun {time_t} {gnutls_x509_crl_get_this_update} (gnutls_x509_crl_t @var{crl})
989 @var{crl}: should contain a @code{gnutls_x509_crl_t}  structure
990
991 This function will return the time this CRL was issued.
992
993 @strong{Returns:} when the CRL was issued, or (time_t)-1 on error.
994 @end deftypefun
995
996 @subheading gnutls_x509_crl_get_version
997 @anchor{gnutls_x509_crl_get_version}
998 @deftypefun {int} {gnutls_x509_crl_get_version} (gnutls_x509_crl_t @var{crl})
999 @var{crl}: should contain a @code{gnutls_x509_crl_t}  structure
1000
1001 This function will return the version of the specified CRL.
1002
1003 @strong{Returns:} The version number, or a negative error code on error.
1004 @end deftypefun
1005
1006 @subheading gnutls_x509_crl_import
1007 @anchor{gnutls_x509_crl_import}
1008 @deftypefun {int} {gnutls_x509_crl_import} (gnutls_x509_crl_t @var{crl}, const gnutls_datum_t * @var{data}, gnutls_x509_crt_fmt_t @var{format})
1009 @var{crl}: The structure to store the parsed CRL.
1010
1011 @var{data}: The DER or PEM encoded CRL.
1012
1013 @var{format}: One of DER or PEM
1014
1015 This function will convert the given DER or PEM encoded CRL
1016 to the native @code{gnutls_x509_crl_t}  format. The output will be stored in 'crl'.
1017
1018 If the CRL is PEM encoded it should have a header of "X509 CRL".
1019
1020 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
1021 negative error value.
1022 @end deftypefun
1023
1024 @subheading gnutls_x509_crl_init
1025 @anchor{gnutls_x509_crl_init}
1026 @deftypefun {int} {gnutls_x509_crl_init} (gnutls_x509_crl_t * @var{crl})
1027 @var{crl}: The structure to be initialized
1028
1029 This function will initialize a CRL structure. CRL stands for
1030 Certificate Revocation List. A revocation list usually contains
1031 lists of certificate serial numbers that have been revoked by an
1032 Authority. The revocation lists are always signed with the
1033 authority's private key.
1034
1035 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
1036 negative error value.
1037 @end deftypefun
1038
1039 @subheading gnutls_x509_crl_iter_crt_serial
1040 @anchor{gnutls_x509_crl_iter_crt_serial}
1041 @deftypefun {int} {gnutls_x509_crl_iter_crt_serial} (gnutls_x509_crl_t @var{crl}, gnutls_x509_crl_iter_t * @var{iter}, unsigned char * @var{serial}, size_t * @var{serial_size}, time_t * @var{t})
1042 @var{crl}: should contain a @code{gnutls_x509_crl_t}  structure
1043
1044 @var{iter}: A pointer to an iterator (initially the iterator should be @code{NULL} )
1045
1046 @var{serial}: where the serial number will be copied
1047
1048 @var{serial_size}: initially holds the size of serial
1049
1050 @var{t}: if non null, will hold the time this certificate was revoked
1051
1052 This function performs the same as @code{gnutls_x509_crl_get_crt_serial()} ,
1053 but reads sequentially and keeps state in the iterator 
1054 between calls. That allows it to provide better performance in sequences 
1055 with many elements (50000+).
1056
1057 When past the last element is accessed @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
1058 is returned and the iterator is reset.
1059
1060 After use, the iterator must be deinitialized using @code{gnutls_x509_crl_iter_deinit()} .
1061
1062 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
1063 negative error value. and a negative error code on error.
1064 @end deftypefun
1065
1066 @subheading gnutls_x509_crl_iter_deinit
1067 @anchor{gnutls_x509_crl_iter_deinit}
1068 @deftypefun {void} {gnutls_x509_crl_iter_deinit} (gnutls_x509_crl_iter_t @var{iter})
1069 @var{iter}: The iterator structure to be deinitialized
1070
1071 This function will deinitialize an iterator structure.
1072 @end deftypefun
1073
1074 @subheading gnutls_x509_crl_list_import
1075 @anchor{gnutls_x509_crl_list_import}
1076 @deftypefun {int} {gnutls_x509_crl_list_import} (gnutls_x509_crl_t * @var{crls}, unsigned int * @var{crl_max}, const gnutls_datum_t * @var{data}, gnutls_x509_crt_fmt_t @var{format}, unsigned int @var{flags})
1077 @var{crls}: The structures to store the parsed CRLs. Must not be initialized.
1078
1079 @var{crl_max}: Initially must hold the maximum number of crls. It will be updated with the number of crls available.
1080
1081 @var{data}: The PEM encoded CRLs
1082
1083 @var{format}: One of DER or PEM.
1084
1085 @var{flags}: must be (0) or an OR'd sequence of gnutls_certificate_import_flags.
1086
1087 This function will convert the given PEM encoded CRL list
1088 to the native gnutls_x509_crl_t format. The output will be stored
1089 in  @code{crls} .  They will be automatically initialized.
1090
1091 If the Certificate is PEM encoded it should have a header of "X509 CRL".
1092
1093 @strong{Returns:} the number of certificates read or a negative error value.
1094
1095 @strong{Since:} 3.0
1096 @end deftypefun
1097
1098 @subheading gnutls_x509_crl_list_import2
1099 @anchor{gnutls_x509_crl_list_import2}
1100 @deftypefun {int} {gnutls_x509_crl_list_import2} (gnutls_x509_crl_t ** @var{crls}, unsigned int * @var{size}, const gnutls_datum_t * @var{data}, gnutls_x509_crt_fmt_t @var{format}, unsigned int @var{flags})
1101 @var{crls}: The structures to store the parsed crl list. Must not be initialized.
1102
1103 @var{size}: It will contain the size of the list.
1104
1105 @var{data}: The PEM encoded CRL.
1106
1107 @var{format}: One of DER or PEM.
1108
1109 @var{flags}: must be (0) or an OR'd sequence of gnutls_certificate_import_flags.
1110
1111 This function will convert the given PEM encoded CRL list
1112 to the native gnutls_x509_crl_t format. The output will be stored
1113 in  @code{crls} .  They will be automatically initialized.
1114
1115 If the Certificate is PEM encoded it should have a header of "X509
1116 CRL".
1117
1118 @strong{Returns:} the number of certificates read or a negative error value.
1119
1120 @strong{Since:} 3.0
1121 @end deftypefun
1122
1123 @subheading gnutls_x509_crl_print
1124 @anchor{gnutls_x509_crl_print}
1125 @deftypefun {int} {gnutls_x509_crl_print} (gnutls_x509_crl_t @var{crl}, gnutls_certificate_print_formats_t @var{format}, gnutls_datum_t * @var{out})
1126 @var{crl}: The structure to be printed
1127
1128 @var{format}: Indicate the format to use
1129
1130 @var{out}: Newly allocated datum with (0) terminated string.
1131
1132 This function will pretty print a X.509 certificate revocation
1133 list, suitable for display to a human.
1134
1135 The output  @code{out} needs to be deallocated using @code{gnutls_free()} .
1136
1137 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
1138 negative error value.
1139 @end deftypefun
1140
1141 @subheading gnutls_x509_crl_set_authority_key_id
1142 @anchor{gnutls_x509_crl_set_authority_key_id}
1143 @deftypefun {int} {gnutls_x509_crl_set_authority_key_id} (gnutls_x509_crl_t @var{crl}, const void * @var{id}, size_t @var{id_size})
1144 @var{crl}: a CRL of type @code{gnutls_x509_crl_t} 
1145
1146 @var{id}: The key ID
1147
1148 @var{id_size}: Holds the size of the serial field.
1149
1150 This function will set the CRL's authority key ID extension.  Only
1151 the keyIdentifier field can be set with this function. This may
1152 be used by an authority that holds multiple private keys, to distinguish
1153 the used key.
1154
1155 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
1156 negative error value.
1157
1158 @strong{Since:} 2.8.0
1159 @end deftypefun
1160
1161 @subheading gnutls_x509_crl_set_crt
1162 @anchor{gnutls_x509_crl_set_crt}
1163 @deftypefun {int} {gnutls_x509_crl_set_crt} (gnutls_x509_crl_t @var{crl}, gnutls_x509_crt_t @var{crt}, time_t @var{revocation_time})
1164 @var{crl}: should contain a gnutls_x509_crl_t structure
1165
1166 @var{crt}: a certificate of type @code{gnutls_x509_crt_t}  with the revoked certificate
1167
1168 @var{revocation_time}: The time this certificate was revoked
1169
1170 This function will set a revoked certificate's serial number to the CRL.
1171
1172 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
1173 negative error value.
1174 @end deftypefun
1175
1176 @subheading gnutls_x509_crl_set_crt_serial
1177 @anchor{gnutls_x509_crl_set_crt_serial}
1178 @deftypefun {int} {gnutls_x509_crl_set_crt_serial} (gnutls_x509_crl_t @var{crl}, const void * @var{serial}, size_t @var{serial_size}, time_t @var{revocation_time})
1179 @var{crl}: should contain a gnutls_x509_crl_t structure
1180
1181 @var{serial}: The revoked certificate's serial number
1182
1183 @var{serial_size}: Holds the size of the serial field.
1184
1185 @var{revocation_time}: The time this certificate was revoked
1186
1187 This function will set a revoked certificate's serial number to the CRL.
1188
1189 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
1190 negative error value.
1191 @end deftypefun
1192
1193 @subheading gnutls_x509_crl_set_next_update
1194 @anchor{gnutls_x509_crl_set_next_update}
1195 @deftypefun {int} {gnutls_x509_crl_set_next_update} (gnutls_x509_crl_t @var{crl}, time_t @var{exp_time})
1196 @var{crl}: should contain a gnutls_x509_crl_t structure
1197
1198 @var{exp_time}: The actual time
1199
1200 This function will set the time this CRL will be updated.
1201
1202 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
1203 negative error value.
1204 @end deftypefun
1205
1206 @subheading gnutls_x509_crl_set_number
1207 @anchor{gnutls_x509_crl_set_number}
1208 @deftypefun {int} {gnutls_x509_crl_set_number} (gnutls_x509_crl_t @var{crl}, const void * @var{nr}, size_t @var{nr_size})
1209 @var{crl}: a CRL of type @code{gnutls_x509_crl_t} 
1210
1211 @var{nr}: The CRL number
1212
1213 @var{nr_size}: Holds the size of the nr field.
1214
1215 This function will set the CRL's number extension. This
1216 is to be used as a unique and monotonic number assigned to
1217 the CRL by the authority.
1218
1219 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
1220 negative error value.
1221
1222 @strong{Since:} 2.8.0
1223 @end deftypefun
1224
1225 @subheading gnutls_x509_crl_set_this_update
1226 @anchor{gnutls_x509_crl_set_this_update}
1227 @deftypefun {int} {gnutls_x509_crl_set_this_update} (gnutls_x509_crl_t @var{crl}, time_t @var{act_time})
1228 @var{crl}: should contain a gnutls_x509_crl_t structure
1229
1230 @var{act_time}: The actual time
1231
1232 This function will set the time this CRL was issued.
1233
1234 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
1235 negative error value.
1236 @end deftypefun
1237
1238 @subheading gnutls_x509_crl_set_version
1239 @anchor{gnutls_x509_crl_set_version}
1240 @deftypefun {int} {gnutls_x509_crl_set_version} (gnutls_x509_crl_t @var{crl}, unsigned int @var{version})
1241 @var{crl}: should contain a gnutls_x509_crl_t structure
1242
1243 @var{version}: holds the version number. For CRLv1 crls must be 1.
1244
1245 This function will set the version of the CRL. This
1246 must be one for CRL version 1, and so on. The CRLs generated
1247 by gnutls should have a version number of 2.
1248
1249 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
1250 negative error value.
1251 @end deftypefun
1252
1253 @subheading gnutls_x509_crl_sign2
1254 @anchor{gnutls_x509_crl_sign2}
1255 @deftypefun {int} {gnutls_x509_crl_sign2} (gnutls_x509_crl_t @var{crl}, gnutls_x509_crt_t @var{issuer}, gnutls_x509_privkey_t @var{issuer_key}, gnutls_digest_algorithm_t @var{dig}, unsigned int @var{flags})
1256 @var{crl}: should contain a gnutls_x509_crl_t structure
1257
1258 @var{issuer}: is the certificate of the certificate issuer
1259
1260 @var{issuer_key}: holds the issuer's private key
1261
1262 @var{dig}: The message digest to use. GNUTLS_DIG_SHA1 is the safe choice unless you know what you're doing.
1263
1264 @var{flags}: must be 0
1265
1266 This function will sign the CRL with the issuer's private key, and
1267 will copy the issuer's information into the CRL.
1268
1269 This must be the last step in a certificate CRL since all
1270 the previously set parameters are now signed.
1271
1272 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
1273 negative error value.
1274 @end deftypefun
1275
1276 @subheading gnutls_x509_crl_verify
1277 @anchor{gnutls_x509_crl_verify}
1278 @deftypefun {int} {gnutls_x509_crl_verify} (gnutls_x509_crl_t @var{crl}, const gnutls_x509_crt_t * @var{trusted_cas}, int @var{tcas_size}, unsigned int @var{flags}, unsigned int * @var{verify})
1279 @var{crl}: is the crl to be verified
1280
1281 @var{trusted_cas}: is a certificate list that is considered to be trusted one
1282
1283 @var{tcas_size}: holds the number of CA certificates in CA_list
1284
1285 @var{flags}: Flags that may be used to change the verification algorithm. Use OR of the gnutls_certificate_verify_flags enumerations.
1286
1287 @var{verify}: will hold the crl verification output.
1288
1289 This function will try to verify the given crl and return its verification status.
1290 See @code{gnutls_x509_crt_list_verify()}  for a detailed description of
1291 return values. Note that since GnuTLS 3.1.4 this function includes
1292 the time checks.
1293
1294 Note that value in  @code{verify} is set only when the return value of this 
1295 function is success (i.e, failure to trust a CRL a certificate does not imply 
1296 a negative return value).
1297
1298 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
1299 negative error value.
1300 @end deftypefun
1301
1302 @subheading gnutls_x509_crq_deinit
1303 @anchor{gnutls_x509_crq_deinit}
1304 @deftypefun {void} {gnutls_x509_crq_deinit} (gnutls_x509_crq_t @var{crq})
1305 @var{crq}: The structure to be initialized
1306
1307 This function will deinitialize a PKCS@code{10}  certificate request
1308 structure.
1309 @end deftypefun
1310
1311 @subheading gnutls_x509_crq_export
1312 @anchor{gnutls_x509_crq_export}
1313 @deftypefun {int} {gnutls_x509_crq_export} (gnutls_x509_crq_t @var{crq}, gnutls_x509_crt_fmt_t @var{format}, void * @var{output_data}, size_t * @var{output_data_size})
1314 @var{crq}: should contain a @code{gnutls_x509_crq_t}  structure
1315
1316 @var{format}: the format of output params. One of PEM or DER.
1317
1318 @var{output_data}: will contain a certificate request PEM or DER encoded
1319
1320 @var{output_data_size}: holds the size of output_data (and will be
1321 replaced by the actual size of parameters)
1322
1323 This function will export the certificate request to a PEM or DER
1324 encoded PKCS10 structure.
1325
1326 If the buffer provided is not long enough to hold the output, then
1327 @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  will be returned and
1328 * @code{output_data_size} will be updated.
1329
1330 If the structure is PEM encoded, it will have a header of "BEGIN
1331 NEW CERTIFICATE REQUEST".
1332
1333 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
1334 negative error value.
1335 @end deftypefun
1336
1337 @subheading gnutls_x509_crq_export2
1338 @anchor{gnutls_x509_crq_export2}
1339 @deftypefun {int} {gnutls_x509_crq_export2} (gnutls_x509_crq_t @var{crq}, gnutls_x509_crt_fmt_t @var{format}, gnutls_datum_t * @var{out})
1340 @var{crq}: should contain a @code{gnutls_x509_crq_t}  structure
1341
1342 @var{format}: the format of output params. One of PEM or DER.
1343
1344 @var{out}: will contain a certificate request PEM or DER encoded
1345
1346 This function will export the certificate request to a PEM or DER
1347 encoded PKCS10 structure.
1348
1349 The output buffer is allocated using @code{gnutls_malloc()} .
1350
1351 If the structure is PEM encoded, it will have a header of "BEGIN
1352 NEW CERTIFICATE REQUEST".
1353
1354 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
1355 negative error value.
1356
1357 Since 3.1.3
1358 @end deftypefun
1359
1360 @subheading gnutls_x509_crq_get_attribute_by_oid
1361 @anchor{gnutls_x509_crq_get_attribute_by_oid}
1362 @deftypefun {int} {gnutls_x509_crq_get_attribute_by_oid} (gnutls_x509_crq_t @var{crq}, const char * @var{oid}, int @var{indx}, void * @var{buf}, size_t * @var{buf_size})
1363 @var{crq}: should contain a @code{gnutls_x509_crq_t}  structure
1364
1365 @var{oid}: holds an Object Identifier in null-terminated string
1366
1367 @var{indx}: In case multiple same OIDs exist in the attribute list, this
1368 specifies which to get, use (0) to get the first one
1369
1370 @var{buf}: a pointer to a structure to hold the attribute data (may be @code{NULL} )
1371
1372 @var{buf_size}: initially holds the size of  @code{buf} 
1373
1374 This function will return the attribute in the certificate request
1375 specified by the given Object ID.  The attribute will be DER
1376 encoded.
1377
1378 Attributes in a certificate request is an optional set of data
1379 appended to the request. Their interpretation depends on the CA policy.
1380
1381 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
1382 negative error value.
1383 @end deftypefun
1384
1385 @subheading gnutls_x509_crq_get_attribute_data
1386 @anchor{gnutls_x509_crq_get_attribute_data}
1387 @deftypefun {int} {gnutls_x509_crq_get_attribute_data} (gnutls_x509_crq_t @var{crq}, int @var{indx}, void * @var{data}, size_t * @var{sizeof_data})
1388 @var{crq}: should contain a @code{gnutls_x509_crq_t}  structure
1389
1390 @var{indx}: Specifies which attribute number to get. Use (0) to get the first one.
1391
1392 @var{data}: a pointer to a structure to hold the data (may be null)
1393
1394 @var{sizeof_data}: initially holds the size of  @code{oid} 
1395
1396 This function will return the requested attribute data in the
1397 certificate request.  The attribute data will be stored as a string in the
1398 provided buffer.
1399
1400 Use @code{gnutls_x509_crq_get_attribute_info()}  to extract the OID.
1401 Use @code{gnutls_x509_crq_get_attribute_by_oid()}  instead,
1402 if you want to get data indexed by the attribute OID rather than
1403 sequence.
1404
1405 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
1406 negative error code in case of an error.  If your have reached the
1407 last extension available @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
1408 will be returned.
1409
1410 @strong{Since:} 2.8.0
1411 @end deftypefun
1412
1413 @subheading gnutls_x509_crq_get_attribute_info
1414 @anchor{gnutls_x509_crq_get_attribute_info}
1415 @deftypefun {int} {gnutls_x509_crq_get_attribute_info} (gnutls_x509_crq_t @var{crq}, int @var{indx}, void * @var{oid}, size_t * @var{sizeof_oid})
1416 @var{crq}: should contain a @code{gnutls_x509_crq_t}  structure
1417
1418 @var{indx}: Specifies which attribute number to get. Use (0) to get the first one.
1419
1420 @var{oid}: a pointer to a structure to hold the OID
1421
1422 @var{sizeof_oid}: initially holds the maximum size of  @code{oid} , on return
1423 holds actual size of  @code{oid} .
1424
1425 This function will return the requested attribute OID in the
1426 certificate, and the critical flag for it.  The attribute OID will
1427 be stored as a string in the provided buffer.  Use
1428 @code{gnutls_x509_crq_get_attribute_data()}  to extract the data.
1429
1430 If the buffer provided is not long enough to hold the output, then
1431 * @code{sizeof_oid} is updated and @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  will be
1432 returned.
1433
1434 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
1435 negative error code in case of an error.  If your have reached the
1436 last extension available @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
1437 will be returned.
1438
1439 @strong{Since:} 2.8.0
1440 @end deftypefun
1441
1442 @subheading gnutls_x509_crq_get_basic_constraints
1443 @anchor{gnutls_x509_crq_get_basic_constraints}
1444 @deftypefun {int} {gnutls_x509_crq_get_basic_constraints} (gnutls_x509_crq_t @var{crq}, unsigned int * @var{critical}, unsigned int * @var{ca}, int * @var{pathlen})
1445 @var{crq}: should contain a @code{gnutls_x509_crq_t}  structure
1446
1447 @var{critical}: will be non-zero if the extension is marked as critical
1448
1449 @var{ca}: pointer to output integer indicating CA status, may be NULL,
1450 value is 1 if the certificate CA flag is set, 0 otherwise.
1451
1452 @var{pathlen}: pointer to output integer indicating path length (may be
1453 NULL), non-negative error codes indicate a present pathLenConstraint
1454 field and the actual value, -1 indicate that the field is absent.
1455
1456 This function will read the certificate's basic constraints, and
1457 return the certificates CA status.  It reads the basicConstraints
1458 X.509 extension (2.5.29.19).
1459
1460 @strong{Returns:} If the certificate is a CA a positive value will be
1461 returned, or (0) if the certificate does not have CA flag set.
1462 A negative error code may be returned in case of errors.  If the
1463 certificate does not contain the basicConstraints extension
1464 @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  will be returned.
1465
1466 @strong{Since:} 2.8.0
1467 @end deftypefun
1468
1469 @subheading gnutls_x509_crq_get_challenge_password
1470 @anchor{gnutls_x509_crq_get_challenge_password}
1471 @deftypefun {int} {gnutls_x509_crq_get_challenge_password} (gnutls_x509_crq_t @var{crq}, char * @var{pass}, size_t * @var{pass_size})
1472 @var{crq}: should contain a @code{gnutls_x509_crq_t}  structure
1473
1474 @var{pass}: will hold a (0)-terminated password string
1475
1476 @var{pass_size}: Initially holds the size of  @code{pass} .
1477
1478 This function will return the challenge password in the request.
1479 The challenge password is intended to be used for requesting a
1480 revocation of the certificate.
1481
1482 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
1483 negative error value.
1484 @end deftypefun
1485
1486 @subheading gnutls_x509_crq_get_dn
1487 @anchor{gnutls_x509_crq_get_dn}
1488 @deftypefun {int} {gnutls_x509_crq_get_dn} (gnutls_x509_crq_t @var{crq}, char * @var{buf}, size_t * @var{buf_size})
1489 @var{crq}: should contain a @code{gnutls_x509_crq_t}  structure
1490
1491 @var{buf}: a pointer to a structure to hold the name (may be @code{NULL} )
1492
1493 @var{buf_size}: initially holds the size of  @code{buf} 
1494
1495 This function will copy the name of the Certificate request subject
1496 to the provided buffer.  The name will be in the form
1497 "C=xxxx,O=yyyy,CN=zzzz" as described in RFC 2253. The output string
1498  @code{buf} will be ASCII or UTF-8 encoded, depending on the certificate
1499 data.
1500
1501 @strong{Returns:} @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  if the provided buffer is not
1502 long enough, and in that case the * @code{buf_size} will be updated with
1503 the required size.  On success 0 is returned.
1504 @end deftypefun
1505
1506 @subheading gnutls_x509_crq_get_dn2
1507 @anchor{gnutls_x509_crq_get_dn2}
1508 @deftypefun {int} {gnutls_x509_crq_get_dn2} (gnutls_x509_crq_t @var{crq}, gnutls_datum_t * @var{dn})
1509 @var{crq}: should contain a @code{gnutls_x509_crq_t}  structure
1510
1511 @var{dn}: a pointer to a structure to hold the name
1512
1513 This function will allocate buffer and copy the name of the Certificate 
1514 request. The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as
1515 described in RFC4514. The output string will be ASCII or UTF-8
1516 encoded, depending on the certificate data.
1517
1518 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
1519 negative error value. and a negative error code on error.
1520
1521 @strong{Since:} 3.1.10
1522 @end deftypefun
1523
1524 @subheading gnutls_x509_crq_get_dn_by_oid
1525 @anchor{gnutls_x509_crq_get_dn_by_oid}
1526 @deftypefun {int} {gnutls_x509_crq_get_dn_by_oid} (gnutls_x509_crq_t @var{crq}, const char * @var{oid}, int @var{indx}, unsigned int @var{raw_flag}, void * @var{buf}, size_t * @var{buf_size})
1527 @var{crq}: should contain a gnutls_x509_crq_t structure
1528
1529 @var{oid}: holds an Object Identifier in a null terminated string
1530
1531 @var{indx}: In case multiple same OIDs exist in the RDN, this specifies
1532 which to get. Use (0) to get the first one.
1533
1534 @var{raw_flag}: If non-zero returns the raw DER data of the DN part.
1535
1536 @var{buf}: a pointer to a structure to hold the name (may be @code{NULL} )
1537
1538 @var{buf_size}: initially holds the size of  @code{buf} 
1539
1540 This function will extract the part of the name of the Certificate
1541 request subject, specified by the given OID. The output will be
1542 encoded as described in RFC2253. The output string will be ASCII
1543 or UTF-8 encoded, depending on the certificate data.
1544
1545 Some helper macros with popular OIDs can be found in gnutls/x509.h
1546 If raw flag is (0), this function will only return known OIDs as
1547 text. Other OIDs will be DER encoded, as described in RFC2253 --
1548 in hex format with a '\#' prefix.  You can check about known OIDs
1549 using @code{gnutls_x509_dn_oid_known()} .
1550
1551 @strong{Returns:} @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  if the provided buffer is
1552 not long enough, and in that case the * @code{buf_size} will be
1553 updated with the required size.  On success 0 is returned.
1554 @end deftypefun
1555
1556 @subheading gnutls_x509_crq_get_dn_oid
1557 @anchor{gnutls_x509_crq_get_dn_oid}
1558 @deftypefun {int} {gnutls_x509_crq_get_dn_oid} (gnutls_x509_crq_t @var{crq}, int @var{indx}, void * @var{oid}, size_t * @var{sizeof_oid})
1559 @var{crq}: should contain a gnutls_x509_crq_t structure
1560
1561 @var{indx}: Specifies which DN OID to get. Use (0) to get the first one.
1562
1563 @var{oid}: a pointer to a structure to hold the name (may be @code{NULL} )
1564
1565 @var{sizeof_oid}: initially holds the size of  @code{oid} 
1566
1567 This function will extract the requested OID of the name of the
1568 certificate request subject, specified by the given index.
1569
1570 @strong{Returns:} @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  if the provided buffer is
1571 not long enough, and in that case the * @code{sizeof_oid} will be
1572 updated with the required size.  On success 0 is returned.
1573 @end deftypefun
1574
1575 @subheading gnutls_x509_crq_get_extension_by_oid
1576 @anchor{gnutls_x509_crq_get_extension_by_oid}
1577 @deftypefun {int} {gnutls_x509_crq_get_extension_by_oid} (gnutls_x509_crq_t @var{crq}, const char * @var{oid}, int @var{indx}, void * @var{buf}, size_t * @var{buf_size}, unsigned int * @var{critical})
1578 @var{crq}: should contain a @code{gnutls_x509_crq_t}  structure
1579
1580 @var{oid}: holds an Object Identifier in a null terminated string
1581
1582 @var{indx}: In case multiple same OIDs exist in the extensions, this
1583 specifies which to get. Use (0) to get the first one.
1584
1585 @var{buf}: a pointer to a structure to hold the name (may be null)
1586
1587 @var{buf_size}: initially holds the size of  @code{buf} 
1588
1589 @var{critical}: will be non-zero if the extension is marked as critical
1590
1591 This function will return the extension specified by the OID in
1592 the certificate.  The extensions will be returned as binary data
1593 DER encoded, in the provided buffer.
1594
1595 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
1596 negative error code in case of an error.  If the certificate does not
1597 contain the specified extension
1598 @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  will be returned.
1599
1600 @strong{Since:} 2.8.0
1601 @end deftypefun
1602
1603 @subheading gnutls_x509_crq_get_extension_data
1604 @anchor{gnutls_x509_crq_get_extension_data}
1605 @deftypefun {int} {gnutls_x509_crq_get_extension_data} (gnutls_x509_crq_t @var{crq}, int @var{indx}, void * @var{data}, size_t * @var{sizeof_data})
1606 @var{crq}: should contain a @code{gnutls_x509_crq_t}  structure
1607
1608 @var{indx}: Specifies which extension number to get. Use (0) to get the first one.
1609
1610 @var{data}: a pointer to a structure to hold the data (may be null)
1611
1612 @var{sizeof_data}: initially holds the size of  @code{oid} 
1613
1614 This function will return the requested extension data in the
1615 certificate.  The extension data will be stored as a string in the
1616 provided buffer.
1617
1618 Use @code{gnutls_x509_crq_get_extension_info()}  to extract the OID and
1619 critical flag.  Use @code{gnutls_x509_crq_get_extension_by_oid()}  instead,
1620 if you want to get data indexed by the extension OID rather than
1621 sequence.
1622
1623 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
1624 negative error code in case of an error.  If your have reached the
1625 last extension available @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
1626 will be returned.
1627
1628 @strong{Since:} 2.8.0
1629 @end deftypefun
1630
1631 @subheading gnutls_x509_crq_get_extension_data2
1632 @anchor{gnutls_x509_crq_get_extension_data2}
1633 @deftypefun {int} {gnutls_x509_crq_get_extension_data2} (gnutls_x509_crq_t @var{crq}, unsigned @var{indx}, gnutls_datum_t * @var{data})
1634 @var{crq}: should contain a @code{gnutls_x509_crq_t}  structure
1635
1636 @var{indx}: Specifies which extension OID to read. Use (0) to get the first one.
1637
1638 @var{data}: will contain the extension DER-encoded data
1639
1640 This function will return the requested extension data in the
1641 certificate request.  The extension data will be allocated using
1642 @code{gnutls_malloc()} .
1643
1644 Use @code{gnutls_x509_crq_get_extension_info()}  to extract the OID.
1645
1646 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned,
1647 otherwise a negative error code is returned.  If you have reached the
1648 last extension available @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
1649 will be returned.
1650
1651 @strong{Since:} 3.3.0
1652 @end deftypefun
1653
1654 @subheading gnutls_x509_crq_get_extension_info
1655 @anchor{gnutls_x509_crq_get_extension_info}
1656 @deftypefun {int} {gnutls_x509_crq_get_extension_info} (gnutls_x509_crq_t @var{crq}, int @var{indx}, void * @var{oid}, size_t * @var{sizeof_oid}, unsigned int * @var{critical})
1657 @var{crq}: should contain a @code{gnutls_x509_crq_t}  structure
1658
1659 @var{indx}: Specifies which extension number to get. Use (0) to get the first one.
1660
1661 @var{oid}: a pointer to a structure to hold the OID
1662
1663 @var{sizeof_oid}: initially holds the maximum size of  @code{oid} , on return
1664 holds actual size of  @code{oid} .
1665
1666 @var{critical}: output variable with critical flag, may be NULL.
1667
1668 This function will return the requested extension OID in the
1669 certificate, and the critical flag for it.  The extension OID will
1670 be stored as a string in the provided buffer.  Use
1671 @code{gnutls_x509_crq_get_extension_data()}  to extract the data.
1672
1673 If the buffer provided is not long enough to hold the output, then
1674 * @code{sizeof_oid} is updated and @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  will be
1675 returned.
1676
1677 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
1678 negative error code in case of an error.  If your have reached the
1679 last extension available @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
1680 will be returned.
1681
1682 @strong{Since:} 2.8.0
1683 @end deftypefun
1684
1685 @subheading gnutls_x509_crq_get_key_id
1686 @anchor{gnutls_x509_crq_get_key_id}
1687 @deftypefun {int} {gnutls_x509_crq_get_key_id} (gnutls_x509_crq_t @var{crq}, unsigned int @var{flags}, unsigned char * @var{output_data}, size_t * @var{output_data_size})
1688 @var{crq}: a certificate of type @code{gnutls_x509_crq_t} 
1689
1690 @var{flags}: should be 0 for now
1691
1692 @var{output_data}: will contain the key ID
1693
1694 @var{output_data_size}: holds the size of output_data (and will be
1695 replaced by the actual size of parameters)
1696
1697 This function will return a unique ID that depends on the public key
1698 parameters.  This ID can be used in checking whether a certificate
1699 corresponds to the given private key.
1700
1701 If the buffer provided is not long enough to hold the output, then
1702 * @code{output_data_size} is updated and GNUTLS_E_SHORT_MEMORY_BUFFER will
1703 be returned.  The output will normally be a SHA-1 hash output,
1704 which is 20 bytes.
1705
1706 @strong{Returns:} In case of failure a negative error code will be
1707 returned, and 0 on success.
1708
1709 @strong{Since:} 2.8.0
1710 @end deftypefun
1711
1712 @subheading gnutls_x509_crq_get_key_purpose_oid
1713 @anchor{gnutls_x509_crq_get_key_purpose_oid}
1714 @deftypefun {int} {gnutls_x509_crq_get_key_purpose_oid} (gnutls_x509_crq_t @var{crq}, int @var{indx}, void * @var{oid}, size_t * @var{sizeof_oid}, unsigned int * @var{critical})
1715 @var{crq}: should contain a @code{gnutls_x509_crq_t}  structure
1716
1717 @var{indx}: This specifies which OID to return, use (0) to get the first one
1718
1719 @var{oid}: a pointer to a buffer to hold the OID (may be @code{NULL} )
1720
1721 @var{sizeof_oid}: initially holds the size of  @code{oid} 
1722
1723 @var{critical}: output variable with critical flag, may be @code{NULL} .
1724
1725 This function will extract the key purpose OIDs of the Certificate
1726 specified by the given index.  These are stored in the Extended Key
1727 Usage extension (2.5.29.37).  See the GNUTLS_KP_* definitions for
1728 human readable names.
1729
1730 @strong{Returns:} @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  if the provided buffer is
1731 not long enough, and in that case the * @code{sizeof_oid} will be
1732 updated with the required size.  On success 0 is returned.
1733
1734 @strong{Since:} 2.8.0
1735 @end deftypefun
1736
1737 @subheading gnutls_x509_crq_get_key_rsa_raw
1738 @anchor{gnutls_x509_crq_get_key_rsa_raw}
1739 @deftypefun {int} {gnutls_x509_crq_get_key_rsa_raw} (gnutls_x509_crq_t @var{crq}, gnutls_datum_t * @var{m}, gnutls_datum_t * @var{e})
1740 @var{crq}: Holds the certificate
1741
1742 @var{m}: will hold the modulus
1743
1744 @var{e}: will hold the public exponent
1745
1746 This function will export the RSA public key's parameters found in
1747 the given structure.  The new parameters will be allocated using
1748 @code{gnutls_malloc()}  and will be stored in the appropriate datum.
1749
1750 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
1751 negative error value.
1752
1753 @strong{Since:} 2.8.0
1754 @end deftypefun
1755
1756 @subheading gnutls_x509_crq_get_key_usage
1757 @anchor{gnutls_x509_crq_get_key_usage}
1758 @deftypefun {int} {gnutls_x509_crq_get_key_usage} (gnutls_x509_crq_t @var{crq}, unsigned int * @var{key_usage}, unsigned int * @var{critical})
1759 @var{crq}: should contain a @code{gnutls_x509_crq_t}  structure
1760
1761 @var{key_usage}: where the key usage bits will be stored
1762
1763 @var{critical}: will be non-zero if the extension is marked as critical
1764
1765 This function will return certificate's key usage, by reading the
1766 keyUsage X.509 extension (2.5.29.15).  The key usage value will
1767 ORed values of the: @code{GNUTLS_KEY_DIGITAL_SIGNATURE} ,
1768 @code{GNUTLS_KEY_NON_REPUDIATION} , @code{GNUTLS_KEY_KEY_ENCIPHERMENT} ,
1769 @code{GNUTLS_KEY_DATA_ENCIPHERMENT} , @code{GNUTLS_KEY_KEY_AGREEMENT} ,
1770 @code{GNUTLS_KEY_KEY_CERT_SIGN} , @code{GNUTLS_KEY_CRL_SIGN} ,
1771 @code{GNUTLS_KEY_ENCIPHER_ONLY} , @code{GNUTLS_KEY_DECIPHER_ONLY} .
1772
1773 @strong{Returns:} the certificate key usage, or a negative error code in case of
1774 parsing error.  If the certificate does not contain the keyUsage
1775 extension @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  will be
1776 returned.
1777
1778 @strong{Since:} 2.8.0
1779 @end deftypefun
1780
1781 @subheading gnutls_x509_crq_get_pk_algorithm
1782 @anchor{gnutls_x509_crq_get_pk_algorithm}
1783 @deftypefun {int} {gnutls_x509_crq_get_pk_algorithm} (gnutls_x509_crq_t @var{crq}, unsigned int * @var{bits})
1784 @var{crq}: should contain a @code{gnutls_x509_crq_t}  structure
1785
1786 @var{bits}: if bits is non-@code{NULL}  it will hold the size of the parameters' in bits
1787
1788 This function will return the public key algorithm of a PKCS@code{10} 
1789 certificate request.
1790
1791 If bits is non-@code{NULL} , it should have enough size to hold the
1792 parameters size in bits.  For RSA the bits returned is the modulus.
1793 For DSA the bits returned are of the public exponent.
1794
1795 @strong{Returns:} a member of the @code{gnutls_pk_algorithm_t}  enumeration on
1796 success, or a negative error code on error.
1797 @end deftypefun
1798
1799 @subheading gnutls_x509_crq_get_private_key_usage_period
1800 @anchor{gnutls_x509_crq_get_private_key_usage_period}
1801 @deftypefun {int} {gnutls_x509_crq_get_private_key_usage_period} (gnutls_x509_crq_t @var{crq}, time_t * @var{activation}, time_t * @var{expiration}, unsigned int * @var{critical})
1802 @var{crq}: should contain a @code{gnutls_x509_crq_t}  structure
1803
1804 @var{activation}: The activation time
1805
1806 @var{expiration}: The expiration time
1807
1808 @var{critical}: the extension status
1809
1810 This function will return the expiration and activation
1811 times of the private key of the certificate.
1812
1813 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
1814 if the extension is not present, otherwise a negative error value.
1815 @end deftypefun
1816
1817 @subheading gnutls_x509_crq_get_subject_alt_name
1818 @anchor{gnutls_x509_crq_get_subject_alt_name}
1819 @deftypefun {int} {gnutls_x509_crq_get_subject_alt_name} (gnutls_x509_crq_t @var{crq}, unsigned int @var{seq}, void * @var{ret}, size_t * @var{ret_size}, unsigned int * @var{ret_type}, unsigned int * @var{critical})
1820 @var{crq}: should contain a @code{gnutls_x509_crq_t}  structure
1821
1822 @var{seq}: specifies the sequence number of the alt name, 0 for the
1823 first one, 1 for the second etc.
1824
1825 @var{ret}: is the place where the alternative name will be copied to
1826
1827 @var{ret_size}: holds the size of ret.
1828
1829 @var{ret_type}: holds the @code{gnutls_x509_subject_alt_name_t}  name type
1830
1831 @var{critical}: will be non-zero if the extension is marked as critical
1832 (may be null)
1833
1834 This function will return the alternative names, contained in the
1835 given certificate.  It is the same as
1836 @code{gnutls_x509_crq_get_subject_alt_name()}  except for the fact that it
1837 will return the type of the alternative name in  @code{ret_type} even if
1838 the function fails for some reason (i.e.  the buffer provided is
1839 not enough).
1840
1841 @strong{Returns:} the alternative subject name type on success, one of the
1842 enumerated @code{gnutls_x509_subject_alt_name_t} .  It will return
1843 @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  if  @code{ret_size} is not large enough to
1844 hold the value.  In that case  @code{ret_size} will be updated with the
1845 required size.  If the certificate request does not have an
1846 Alternative name with the specified sequence number then
1847 @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  is returned.
1848
1849 @strong{Since:} 2.8.0
1850 @end deftypefun
1851
1852 @subheading gnutls_x509_crq_get_subject_alt_othername_oid
1853 @anchor{gnutls_x509_crq_get_subject_alt_othername_oid}
1854 @deftypefun {int} {gnutls_x509_crq_get_subject_alt_othername_oid} (gnutls_x509_crq_t @var{crq}, unsigned int @var{seq}, void * @var{ret}, size_t * @var{ret_size})
1855 @var{crq}: should contain a @code{gnutls_x509_crq_t}  structure
1856
1857 @var{seq}: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.)
1858
1859 @var{ret}: is the place where the otherName OID will be copied to
1860
1861 @var{ret_size}: holds the size of ret.
1862
1863 This function will extract the type OID of an otherName Subject
1864 Alternative Name, contained in the given certificate, and return
1865 the type as an enumerated element.
1866
1867 This function is only useful if
1868 @code{gnutls_x509_crq_get_subject_alt_name()}  returned
1869 @code{GNUTLS_SAN_OTHERNAME} .
1870
1871 @strong{Returns:} the alternative subject name type on success, one of the
1872 enumerated gnutls_x509_subject_alt_name_t.  For supported OIDs,
1873 it will return one of the virtual (GNUTLS_SAN_OTHERNAME_*) types,
1874 e.g. @code{GNUTLS_SAN_OTHERNAME_XMPP} , and @code{GNUTLS_SAN_OTHERNAME}  for
1875 unknown OIDs.  It will return @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  if
1876  @code{ret_size} is not large enough to hold the value.  In that case
1877  @code{ret_size} will be updated with the required size.  If the
1878 certificate does not have an Alternative name with the specified
1879 sequence number and with the otherName type then
1880 @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  is returned.
1881
1882 @strong{Since:} 2.8.0
1883 @end deftypefun
1884
1885 @subheading gnutls_x509_crq_get_version
1886 @anchor{gnutls_x509_crq_get_version}
1887 @deftypefun {int} {gnutls_x509_crq_get_version} (gnutls_x509_crq_t @var{crq})
1888 @var{crq}: should contain a @code{gnutls_x509_crq_t}  structure
1889
1890 This function will return the version of the specified Certificate
1891 request.
1892
1893 @strong{Returns:} version of certificate request, or a negative error code on
1894 error.
1895 @end deftypefun
1896
1897 @subheading gnutls_x509_crq_import
1898 @anchor{gnutls_x509_crq_import}
1899 @deftypefun {int} {gnutls_x509_crq_import} (gnutls_x509_crq_t @var{crq}, const gnutls_datum_t * @var{data}, gnutls_x509_crt_fmt_t @var{format})
1900 @var{crq}: The structure to store the parsed certificate request.
1901
1902 @var{data}: The DER or PEM encoded certificate.
1903
1904 @var{format}: One of DER or PEM
1905
1906 This function will convert the given DER or PEM encoded certificate
1907 request to a @code{gnutls_x509_crq_t}  structure.  The output will be
1908 stored in  @code{crq} .
1909
1910 If the Certificate is PEM encoded it should have a header of "NEW
1911 CERTIFICATE REQUEST".
1912
1913 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
1914 negative error value.
1915 @end deftypefun
1916
1917 @subheading gnutls_x509_crq_init
1918 @anchor{gnutls_x509_crq_init}
1919 @deftypefun {int} {gnutls_x509_crq_init} (gnutls_x509_crq_t * @var{crq})
1920 @var{crq}: The structure to be initialized
1921
1922 This function will initialize a PKCS@code{10}  certificate request
1923 structure.
1924
1925 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
1926 negative error value.
1927 @end deftypefun
1928
1929 @subheading gnutls_x509_crq_print
1930 @anchor{gnutls_x509_crq_print}
1931 @deftypefun {int} {gnutls_x509_crq_print} (gnutls_x509_crq_t @var{crq}, gnutls_certificate_print_formats_t @var{format}, gnutls_datum_t * @var{out})
1932 @var{crq}: The structure to be printed
1933
1934 @var{format}: Indicate the format to use
1935
1936 @var{out}: Newly allocated datum with (0) terminated string.
1937
1938 This function will pretty print a certificate request, suitable for
1939 display to a human.
1940
1941 The output  @code{out} needs to be deallocated using @code{gnutls_free()} .
1942
1943 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
1944 negative error value.
1945
1946 @strong{Since:} 2.8.0
1947 @end deftypefun
1948
1949 @subheading gnutls_x509_crq_set_attribute_by_oid
1950 @anchor{gnutls_x509_crq_set_attribute_by_oid}
1951 @deftypefun {int} {gnutls_x509_crq_set_attribute_by_oid} (gnutls_x509_crq_t @var{crq}, const char * @var{oid}, void * @var{buf}, size_t @var{buf_size})
1952 @var{crq}: should contain a @code{gnutls_x509_crq_t}  structure
1953
1954 @var{oid}: holds an Object Identifier in a null-terminated string
1955
1956 @var{buf}: a pointer to a structure that holds the attribute data
1957
1958 @var{buf_size}: holds the size of  @code{buf} 
1959
1960 This function will set the attribute in the certificate request
1961 specified by the given Object ID. The provided attribute must be be DER
1962 encoded.
1963
1964 Attributes in a certificate request is an optional set of data
1965 appended to the request. Their interpretation depends on the CA policy.
1966
1967 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
1968 negative error value.
1969 @end deftypefun
1970
1971 @subheading gnutls_x509_crq_set_basic_constraints
1972 @anchor{gnutls_x509_crq_set_basic_constraints}
1973 @deftypefun {int} {gnutls_x509_crq_set_basic_constraints} (gnutls_x509_crq_t @var{crq}, unsigned int @var{ca}, int @var{pathLenConstraint})
1974 @var{crq}: a certificate request of type @code{gnutls_x509_crq_t} 
1975
1976 @var{ca}: true(1) or false(0) depending on the Certificate authority status.
1977
1978 @var{pathLenConstraint}: non-negative error codes indicate maximum length of path,
1979 and negative error codes indicate that the pathLenConstraints field should
1980 not be present.
1981
1982 This function will set the basicConstraints certificate extension.
1983
1984 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
1985 negative error value.
1986
1987 @strong{Since:} 2.8.0
1988 @end deftypefun
1989
1990 @subheading gnutls_x509_crq_set_challenge_password
1991 @anchor{gnutls_x509_crq_set_challenge_password}
1992 @deftypefun {int} {gnutls_x509_crq_set_challenge_password} (gnutls_x509_crq_t @var{crq}, const char * @var{pass})
1993 @var{crq}: should contain a @code{gnutls_x509_crq_t}  structure
1994
1995 @var{pass}: holds a (0)-terminated password
1996
1997 This function will set a challenge password to be used when
1998 revoking the request.
1999
2000 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
2001 negative error value.
2002 @end deftypefun
2003
2004 @subheading gnutls_x509_crq_set_dn
2005 @anchor{gnutls_x509_crq_set_dn}
2006 @deftypefun {int} {gnutls_x509_crq_set_dn} (gnutls_x509_crq_t @var{crq}, const char * @var{dn}, const char ** @var{err})
2007 @var{crq}: a certificate of type @code{gnutls_x509_crq_t} 
2008
2009 @var{dn}: a comma separated DN string (RFC4514)
2010
2011 @var{err}: indicates the error position (if any)
2012
2013 This function will set the DN on the provided certificate.
2014 The input string should be plain ASCII or UTF-8 encoded.
2015
2016 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
2017 negative error value.
2018 @end deftypefun
2019
2020 @subheading gnutls_x509_crq_set_dn_by_oid
2021 @anchor{gnutls_x509_crq_set_dn_by_oid}
2022 @deftypefun {int} {gnutls_x509_crq_set_dn_by_oid} (gnutls_x509_crq_t @var{crq}, const char * @var{oid}, unsigned int @var{raw_flag}, const void * @var{data}, unsigned int @var{sizeof_data})
2023 @var{crq}: should contain a @code{gnutls_x509_crq_t}  structure
2024
2025 @var{oid}: holds an Object Identifier in a (0)-terminated string
2026
2027 @var{raw_flag}: must be 0, or 1 if the data are DER encoded
2028
2029 @var{data}: a pointer to the input data
2030
2031 @var{sizeof_data}: holds the size of  @code{data} 
2032
2033 This function will set the part of the name of the Certificate
2034 request subject, specified by the given OID.  The input string
2035 should be ASCII or UTF-8 encoded.
2036
2037 Some helper macros with popular OIDs can be found in gnutls/x509.h
2038 With this function you can only set the known OIDs.  You can test
2039 for known OIDs using @code{gnutls_x509_dn_oid_known()} .  For OIDs that are
2040 not known (by gnutls) you should properly DER encode your data, and
2041 call this function with raw_flag set.
2042
2043 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
2044 negative error value.
2045 @end deftypefun
2046
2047 @subheading gnutls_x509_crq_set_key
2048 @anchor{gnutls_x509_crq_set_key}
2049 @deftypefun {int} {gnutls_x509_crq_set_key} (gnutls_x509_crq_t @var{crq}, gnutls_x509_privkey_t @var{key})
2050 @var{crq}: should contain a @code{gnutls_x509_crq_t}  structure
2051
2052 @var{key}: holds a private key
2053
2054 This function will set the public parameters from the given private
2055 key to the request.  
2056
2057 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
2058 negative error value.
2059 @end deftypefun
2060
2061 @subheading gnutls_x509_crq_set_key_purpose_oid
2062 @anchor{gnutls_x509_crq_set_key_purpose_oid}
2063 @deftypefun {int} {gnutls_x509_crq_set_key_purpose_oid} (gnutls_x509_crq_t @var{crq}, const void * @var{oid}, unsigned int @var{critical})
2064 @var{crq}: a certificate of type @code{gnutls_x509_crq_t} 
2065
2066 @var{oid}: a pointer to a (0)-terminated string that holds the OID
2067
2068 @var{critical}: Whether this extension will be critical or not
2069
2070 This function will set the key purpose OIDs of the Certificate.
2071 These are stored in the Extended Key Usage extension (2.5.29.37)
2072 See the GNUTLS_KP_* definitions for human readable names.
2073
2074 Subsequent calls to this function will append OIDs to the OID list.
2075
2076 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
2077 negative error value.
2078
2079 @strong{Since:} 2.8.0
2080 @end deftypefun
2081
2082 @subheading gnutls_x509_crq_set_key_rsa_raw
2083 @anchor{gnutls_x509_crq_set_key_rsa_raw}
2084 @deftypefun {int} {gnutls_x509_crq_set_key_rsa_raw} (gnutls_x509_crq_t @var{crq}, const gnutls_datum_t * @var{m}, const gnutls_datum_t * @var{e})
2085 @var{crq}: should contain a @code{gnutls_x509_crq_t}  structure
2086
2087 @var{m}: holds the modulus
2088
2089 @var{e}: holds the public exponent
2090
2091 This function will set the public parameters from the given private
2092 key to the request. Only RSA keys are currently supported.
2093
2094 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
2095 negative error value.
2096
2097 @strong{Since:} 2.6.0
2098 @end deftypefun
2099
2100 @subheading gnutls_x509_crq_set_key_usage
2101 @anchor{gnutls_x509_crq_set_key_usage}
2102 @deftypefun {int} {gnutls_x509_crq_set_key_usage} (gnutls_x509_crq_t @var{crq}, unsigned int @var{usage})
2103 @var{crq}: a certificate request of type @code{gnutls_x509_crq_t} 
2104
2105 @var{usage}: an ORed sequence of the GNUTLS_KEY_* elements.
2106
2107 This function will set the keyUsage certificate extension.
2108
2109 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
2110 negative error value.
2111
2112 @strong{Since:} 2.8.0
2113 @end deftypefun
2114
2115 @subheading gnutls_x509_crq_set_private_key_usage_period
2116 @anchor{gnutls_x509_crq_set_private_key_usage_period}
2117 @deftypefun {int} {gnutls_x509_crq_set_private_key_usage_period} (gnutls_x509_crq_t @var{crq}, time_t @var{activation}, time_t @var{expiration})
2118 @var{crq}: a certificate of type @code{gnutls_x509_crq_t} 
2119
2120 @var{activation}: The activation time
2121
2122 @var{expiration}: The expiration time
2123
2124 This function will set the private key usage period extension (2.5.29.16).
2125
2126 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
2127 negative error value.
2128 @end deftypefun
2129
2130 @subheading gnutls_x509_crq_set_subject_alt_name
2131 @anchor{gnutls_x509_crq_set_subject_alt_name}
2132 @deftypefun {int} {gnutls_x509_crq_set_subject_alt_name} (gnutls_x509_crq_t @var{crq}, gnutls_x509_subject_alt_name_t @var{nt}, const void * @var{data}, unsigned int @var{data_size}, unsigned int @var{flags})
2133 @var{crq}: a certificate request of type @code{gnutls_x509_crq_t} 
2134
2135 @var{nt}: is one of the @code{gnutls_x509_subject_alt_name_t}  enumerations
2136
2137 @var{data}: The data to be set
2138
2139 @var{data_size}: The size of data to be set
2140
2141 @var{flags}: @code{GNUTLS_FSAN_SET}  to clear previous data or
2142 @code{GNUTLS_FSAN_APPEND}  to append.
2143
2144 This function will set the subject alternative name certificate
2145 extension.  It can set the following types:
2146
2147 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
2148 negative error value.
2149
2150 @strong{Since:} 2.8.0
2151 @end deftypefun
2152
2153 @subheading gnutls_x509_crq_set_version
2154 @anchor{gnutls_x509_crq_set_version}
2155 @deftypefun {int} {gnutls_x509_crq_set_version} (gnutls_x509_crq_t @var{crq}, unsigned int @var{version})
2156 @var{crq}: should contain a @code{gnutls_x509_crq_t}  structure
2157
2158 @var{version}: holds the version number, for v1 Requests must be 1
2159
2160 This function will set the version of the certificate request.  For
2161 version 1 requests this must be one.
2162
2163 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
2164 negative error value.
2165 @end deftypefun
2166
2167 @subheading gnutls_x509_crq_sign2
2168 @anchor{gnutls_x509_crq_sign2}
2169 @deftypefun {int} {gnutls_x509_crq_sign2} (gnutls_x509_crq_t @var{crq}, gnutls_x509_privkey_t @var{key}, gnutls_digest_algorithm_t @var{dig}, unsigned int @var{flags})
2170 @var{crq}: should contain a @code{gnutls_x509_crq_t}  structure
2171
2172 @var{key}: holds a private key
2173
2174 @var{dig}: The message digest to use, i.e., @code{GNUTLS_DIG_SHA1} 
2175
2176 @var{flags}: must be 0
2177
2178 This function will sign the certificate request with a private key.
2179 This must be the same key as the one used in
2180 @code{gnutls_x509_crt_set_key()}  since a certificate request is self
2181 signed.
2182
2183 This must be the last step in a certificate request generation
2184 since all the previously set parameters are now signed.
2185
2186 @strong{Returns:} @code{GNUTLS_E_SUCCESS}  on success, otherwise a negative error code.
2187 @code{GNUTLS_E_ASN1_VALUE_NOT_FOUND}  is returned if you didn't set all
2188 information in the certificate request (e.g., the version using
2189 @code{gnutls_x509_crq_set_version()} ).
2190 @end deftypefun
2191
2192 @subheading gnutls_x509_crq_verify
2193 @anchor{gnutls_x509_crq_verify}
2194 @deftypefun {int} {gnutls_x509_crq_verify} (gnutls_x509_crq_t @var{crq}, unsigned int @var{flags})
2195 @var{crq}: is the crq to be verified
2196
2197 @var{flags}: Flags that may be used to change the verification algorithm. Use OR of the gnutls_certificate_verify_flags enumerations.
2198
2199 This function will verify self signature in the certificate
2200 request and return its status.
2201
2202 @strong{Returns:} In case of a verification failure @code{GNUTLS_E_PK_SIG_VERIFY_FAILED}  
2203 is returned, and zero or positive code on success.
2204
2205 Since 2.12.0
2206 @end deftypefun
2207
2208 @subheading gnutls_x509_crt_check_hostname
2209 @anchor{gnutls_x509_crt_check_hostname}
2210 @deftypefun {int} {gnutls_x509_crt_check_hostname} (gnutls_x509_crt_t @var{cert}, const char * @var{hostname})
2211 @var{cert}: should contain an gnutls_x509_crt_t structure
2212
2213 @var{hostname}: A null terminated string that contains a DNS name
2214
2215 This function will check if the given certificate's subject matches
2216 the given hostname.  This is a basic implementation of the matching
2217 described in RFC2818 (HTTPS), which takes into account wildcards,
2218 and the DNSName/IPAddress subject alternative name PKIX extension.
2219
2220 The comparison may have false-negatives as it is done byte by byte in 
2221 non-ascii names.
2222
2223 Wildcards are only considered if the domain name consists of three
2224 components or more, and the wildcard starts at the leftmost position.
2225
2226 @strong{Returns:} non-zero for a successful match, and zero on failure.
2227 @end deftypefun
2228
2229 @subheading gnutls_x509_crt_check_hostname2
2230 @anchor{gnutls_x509_crt_check_hostname2}
2231 @deftypefun {int} {gnutls_x509_crt_check_hostname2} (gnutls_x509_crt_t @var{cert}, const char * @var{hostname}, unsigned int @var{flags})
2232 @var{cert}: should contain an gnutls_x509_crt_t structure
2233
2234 @var{hostname}: A null terminated string that contains a DNS name
2235
2236 @var{flags}: gnutls_certificate_verify_flags
2237
2238 This function will check if the given certificate's subject matches
2239 the given hostname.  This is a basic implementation of the matching
2240 described in RFC2818 (HTTPS), which takes into account wildcards,
2241 and the DNSName/IPAddress subject alternative name PKIX extension.
2242
2243 The comparison may have false-negatives as it is done byte by byte in 
2244 non-ascii names.
2245
2246 When the flag @code{GNUTLS_VERIFY_DO_NOT_ALLOW_WILDCARDS}  is specified no
2247 wildcards are considered. Otherwise they are only considered if the
2248 domain name consists of three components or more, and the wildcard
2249 starts at the leftmost position.
2250
2251 @strong{Returns:} non-zero for a successful match, and zero on failure.
2252 @end deftypefun
2253
2254 @subheading gnutls_x509_crt_check_issuer
2255 @anchor{gnutls_x509_crt_check_issuer}
2256 @deftypefun {int} {gnutls_x509_crt_check_issuer} (gnutls_x509_crt_t @var{cert}, gnutls_x509_crt_t @var{issuer})
2257 @var{cert}: is the certificate to be checked
2258
2259 @var{issuer}: is the certificate of a possible issuer
2260
2261 This function will check if the given certificate was issued by the
2262 given issuer. It checks the DN fields and the authority
2263 key identifier and subject key identifier fields match.
2264
2265 @strong{Returns:} It will return true (1) if the given certificate is issued
2266 by the given issuer, and false (0) if not.  
2267 @end deftypefun
2268
2269 @subheading gnutls_x509_crt_check_revocation
2270 @anchor{gnutls_x509_crt_check_revocation}
2271 @deftypefun {int} {gnutls_x509_crt_check_revocation} (gnutls_x509_crt_t @var{cert}, const gnutls_x509_crl_t * @var{crl_list}, int @var{crl_list_length})
2272 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
2273
2274 @var{crl_list}: should contain a list of gnutls_x509_crl_t structures
2275
2276 @var{crl_list_length}: the length of the crl_list
2277
2278 This function will return check if the given certificate is
2279 revoked.  It is assumed that the CRLs have been verified before.
2280
2281 @strong{Returns:} 0 if the certificate is NOT revoked, and 1 if it is.  A
2282 negative error code is returned on error.
2283 @end deftypefun
2284
2285 @subheading gnutls_x509_crt_cpy_crl_dist_points
2286 @anchor{gnutls_x509_crt_cpy_crl_dist_points}
2287 @deftypefun {int} {gnutls_x509_crt_cpy_crl_dist_points} (gnutls_x509_crt_t @var{dst}, gnutls_x509_crt_t @var{src})
2288 @var{dst}: a certificate of type @code{gnutls_x509_crt_t} 
2289
2290 @var{src}: the certificate where the dist points will be copied from
2291
2292 This function will copy the CRL distribution points certificate
2293 extension, from the source to the destination certificate.
2294 This may be useful to copy from a CA certificate to issued ones.
2295
2296 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
2297 negative error value.
2298 @end deftypefun
2299
2300 @subheading gnutls_x509_crt_deinit
2301 @anchor{gnutls_x509_crt_deinit}
2302 @deftypefun {void} {gnutls_x509_crt_deinit} (gnutls_x509_crt_t @var{cert})
2303 @var{cert}: The structure to be deinitialized
2304
2305 This function will deinitialize a certificate structure.
2306 @end deftypefun
2307
2308 @subheading gnutls_x509_crt_export
2309 @anchor{gnutls_x509_crt_export}
2310 @deftypefun {int} {gnutls_x509_crt_export} (gnutls_x509_crt_t @var{cert}, gnutls_x509_crt_fmt_t @var{format}, void * @var{output_data}, size_t * @var{output_data_size})
2311 @var{cert}: Holds the certificate
2312
2313 @var{format}: the format of output params. One of PEM or DER.
2314
2315 @var{output_data}: will contain a certificate PEM or DER encoded
2316
2317 @var{output_data_size}: holds the size of output_data (and will be
2318 replaced by the actual size of parameters)
2319
2320 This function will export the certificate to DER or PEM format.
2321
2322 If the buffer provided is not long enough to hold the output, then
2323 *output_data_size is updated and GNUTLS_E_SHORT_MEMORY_BUFFER will
2324 be returned.
2325
2326 If the structure is PEM encoded, it will have a header
2327 of "BEGIN CERTIFICATE".
2328
2329 @strong{Returns:} In case of failure a negative error code will be
2330 returned, and 0 on success.
2331 @end deftypefun
2332
2333 @subheading gnutls_x509_crt_export2
2334 @anchor{gnutls_x509_crt_export2}
2335 @deftypefun {int} {gnutls_x509_crt_export2} (gnutls_x509_crt_t @var{cert}, gnutls_x509_crt_fmt_t @var{format}, gnutls_datum_t * @var{out})
2336 @var{cert}: Holds the certificate
2337
2338 @var{format}: the format of output params. One of PEM or DER.
2339
2340 @var{out}: will contain a certificate PEM or DER encoded
2341
2342 This function will export the certificate to DER or PEM format.
2343 The output buffer is allocated using @code{gnutls_malloc()} .
2344
2345 If the structure is PEM encoded, it will have a header
2346 of "BEGIN CERTIFICATE".
2347
2348 @strong{Returns:} In case of failure a negative error code will be
2349 returned, and 0 on success.
2350
2351 @strong{Since:} 3.1.3
2352 @end deftypefun
2353
2354 @subheading gnutls_x509_crt_get_activation_time
2355 @anchor{gnutls_x509_crt_get_activation_time}
2356 @deftypefun {time_t} {gnutls_x509_crt_get_activation_time} (gnutls_x509_crt_t @var{cert})
2357 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
2358
2359 This function will return the time this Certificate was or will be
2360 activated.
2361
2362 @strong{Returns:} activation time, or (time_t)-1 on error.
2363 @end deftypefun
2364
2365 @subheading gnutls_x509_crt_get_authority_info_access
2366 @anchor{gnutls_x509_crt_get_authority_info_access}
2367 @deftypefun {int} {gnutls_x509_crt_get_authority_info_access} (gnutls_x509_crt_t @var{crt}, unsigned int @var{seq}, int @var{what}, gnutls_datum_t * @var{data}, unsigned int * @var{critical})
2368 @var{crt}: Holds the certificate
2369
2370 @var{seq}: specifies the sequence number of the access descriptor (0 for the first one, 1 for the second etc.)
2371
2372 @var{what}: what data to get, a @code{gnutls_info_access_what_t}  type.
2373
2374 @var{data}: output data to be freed with @code{gnutls_free()} .
2375
2376 @var{critical}: pointer to output integer that is set to non-0 if the extension is marked as critical (may be @code{NULL} )
2377
2378 Note that a simpler API to access the authority info data is provided
2379 by @code{gnutls_x509_aia_get()}  and @code{gnutls_x509_ext_import_aia()} .
2380
2381 This function extracts the Authority Information Access (AIA)
2382 extension, see RFC 5280 section 4.2.2.1 for more information.  The
2383 AIA extension holds a sequence of AccessDescription (AD) data.
2384
2385 The  @code{seq} input parameter is used to indicate which member of the
2386 sequence the caller is interested in.  The first member is 0, the
2387 second member 1 and so on.  When the  @code{seq} value is out of bounds,
2388 @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  is returned.
2389
2390 The type of data returned in  @code{data} is specified via  @code{what} which
2391 should be @code{gnutls_info_access_what_t}  values.
2392
2393 If  @code{what} is @code{GNUTLS_IA_ACCESSMETHOD_OID}  then  @code{data} will hold the
2394 accessMethod OID (e.g., "1.3.6.1.5.5.7.48.1").
2395
2396 If  @code{what} is @code{GNUTLS_IA_ACCESSLOCATION_GENERALNAME_TYPE} ,  @code{data} will
2397 hold the accessLocation GeneralName type (e.g.,
2398 "uniformResourceIdentifier").
2399
2400 If  @code{what} is @code{GNUTLS_IA_URI} ,  @code{data} will hold the accessLocation URI
2401 data.  Requesting this  @code{what} value leads to an error if the
2402 accessLocation is not of the "uniformResourceIdentifier" type.
2403
2404 If  @code{what} is @code{GNUTLS_IA_OCSP_URI} ,  @code{data} will hold the OCSP URI.
2405 Requesting this  @code{what} value leads to an error if the accessMethod
2406 is not 1.3.6.1.5.5.7.48.1 aka OSCP, or if accessLocation is not of
2407 the "uniformResourceIdentifier" type.
2408
2409 If  @code{what} is @code{GNUTLS_IA_CAISSUERS_URI} ,  @code{data} will hold the caIssuers
2410 URI.  Requesting this  @code{what} value leads to an error if the
2411 accessMethod is not 1.3.6.1.5.5.7.48.2 aka caIssuers, or if
2412 accessLocation is not of the "uniformResourceIdentifier" type.
2413
2414 More  @code{what} values may be allocated in the future as needed.
2415
2416 If  @code{data} is NULL, the function does the same without storing the
2417 output data, that is, it will set  @code{critical} and do error checking
2418 as usual.
2419
2420 The value of the critical flag is returned in * @code{critical} .  Supply a
2421 NULL  @code{critical} if you want the function to make sure the extension
2422 is non-critical, as required by RFC 5280.
2423
2424 @strong{Returns:} @code{GNUTLS_E_SUCCESS}  on success, @code{GNUTLS_E_INVALID_REQUEST}  on
2425 invalid  @code{crt} , @code{GNUTLS_E_CONSTRAINT_ERROR}  if the extension is
2426 incorrectly marked as critical (use a non-NULL  @code{critical} to
2427 override), @code{GNUTLS_E_UNKNOWN_ALGORITHM}  if the requested OID does
2428 not match (e.g., when using @code{GNUTLS_IA_OCSP_URI} ), otherwise a
2429 negative error code.
2430
2431 @strong{Since:} 3.0
2432 @end deftypefun
2433
2434 @subheading gnutls_x509_crt_get_authority_key_gn_serial
2435 @anchor{gnutls_x509_crt_get_authority_key_gn_serial}
2436 @deftypefun {int} {gnutls_x509_crt_get_authority_key_gn_serial} (gnutls_x509_crt_t @var{cert}, unsigned int @var{seq}, void * @var{alt}, size_t * @var{alt_size}, unsigned int * @var{alt_type}, void * @var{serial}, size_t * @var{serial_size}, unsigned int * @var{critical})
2437 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
2438
2439 @var{seq}: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.)
2440
2441 @var{alt}: is the place where the alternative name will be copied to
2442
2443 @var{alt_size}: holds the size of alt.
2444
2445 @var{alt_type}: holds the type of the alternative name (one of gnutls_x509_subject_alt_name_t).
2446
2447 @var{serial}: buffer to store the serial number (may be null)
2448
2449 @var{serial_size}: Holds the size of the serial field (may be null)
2450
2451 @var{critical}: will be non-zero if the extension is marked as critical (may be null)
2452
2453 This function will return the X.509 authority key
2454 identifier when stored as a general name (authorityCertIssuer) 
2455 and serial number.
2456
2457 Because more than one general names might be stored
2458  @code{seq} can be used as a counter to request them all until 
2459 @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  is returned.
2460
2461 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
2462 if the extension is not present, otherwise a negative error value.
2463
2464 @strong{Since:} 3.0
2465 @end deftypefun
2466
2467 @subheading gnutls_x509_crt_get_authority_key_id
2468 @anchor{gnutls_x509_crt_get_authority_key_id}
2469 @deftypefun {int} {gnutls_x509_crt_get_authority_key_id} (gnutls_x509_crt_t @var{cert}, void * @var{id}, size_t * @var{id_size}, unsigned int * @var{critical})
2470 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
2471
2472 @var{id}: The place where the identifier will be copied
2473
2474 @var{id_size}: Holds the size of the id field.
2475
2476 @var{critical}: will be non-zero if the extension is marked as critical (may be null)
2477
2478 This function will return the X.509v3 certificate authority's key
2479 identifier.  This is obtained by the X.509 Authority Key
2480 identifier extension field (2.5.29.35). Note that this function
2481 only returns the keyIdentifier field of the extension and
2482 @code{GNUTLS_E_X509_UNSUPPORTED_EXTENSION} , if the extension contains
2483 the name and serial number of the certificate. In that case
2484 @code{gnutls_x509_crt_get_authority_key_gn_serial()}  may be used.
2485
2486 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
2487 if the extension is not present, otherwise a negative error value.
2488 @end deftypefun
2489
2490 @subheading gnutls_x509_crt_get_basic_constraints
2491 @anchor{gnutls_x509_crt_get_basic_constraints}
2492 @deftypefun {int} {gnutls_x509_crt_get_basic_constraints} (gnutls_x509_crt_t @var{cert}, unsigned int * @var{critical}, unsigned int * @var{ca}, int * @var{pathlen})
2493 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
2494
2495 @var{critical}: will be non-zero if the extension is marked as critical
2496
2497 @var{ca}: pointer to output integer indicating CA status, may be NULL,
2498 value is 1 if the certificate CA flag is set, 0 otherwise.
2499
2500 @var{pathlen}: pointer to output integer indicating path length (may be
2501 NULL), non-negative error codes indicate a present pathLenConstraint
2502 field and the actual value, -1 indicate that the field is absent.
2503
2504 This function will read the certificate's basic constraints, and
2505 return the certificates CA status.  It reads the basicConstraints
2506 X.509 extension (2.5.29.19).
2507
2508 @strong{Returns:} If the certificate is a CA a positive value will be
2509 returned, or (0) if the certificate does not have CA flag set.  A
2510 negative error code may be returned in case of errors.  If the
2511 certificate does not contain the basicConstraints extension
2512 GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned.
2513 @end deftypefun
2514
2515 @subheading gnutls_x509_crt_get_ca_status
2516 @anchor{gnutls_x509_crt_get_ca_status}
2517 @deftypefun {int} {gnutls_x509_crt_get_ca_status} (gnutls_x509_crt_t @var{cert}, unsigned int * @var{critical})
2518 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
2519
2520 @var{critical}: will be non-zero if the extension is marked as critical
2521
2522 This function will return certificates CA status, by reading the
2523 basicConstraints X.509 extension (2.5.29.19). If the certificate is
2524 a CA a positive value will be returned, or (0) if the certificate
2525 does not have CA flag set.
2526
2527 Use @code{gnutls_x509_crt_get_basic_constraints()}  if you want to read the
2528 pathLenConstraint field too.
2529
2530 @strong{Returns:} A negative error code may be returned in case of parsing error.
2531 If the certificate does not contain the basicConstraints extension
2532 @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  will be returned.
2533 @end deftypefun
2534
2535 @subheading gnutls_x509_crt_get_crl_dist_points
2536 @anchor{gnutls_x509_crt_get_crl_dist_points}
2537 @deftypefun {int} {gnutls_x509_crt_get_crl_dist_points} (gnutls_x509_crt_t @var{cert}, unsigned int @var{seq}, void * @var{san}, size_t * @var{san_size}, unsigned int * @var{reason_flags}, unsigned int * @var{critical})
2538 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
2539
2540 @var{seq}: specifies the sequence number of the distribution point (0 for the first one, 1 for the second etc.)
2541
2542 @var{san}: is the place where the distribution point will be copied to
2543
2544 @var{san_size}: holds the size of ret.
2545
2546 @var{reason_flags}: Revocation reasons. An ORed sequence of flags from @code{gnutls_x509_crl_reason_flags_t} .
2547
2548 @var{critical}: will be non-zero if the extension is marked as critical (may be null)
2549
2550 This function retrieves the CRL distribution points (2.5.29.31),
2551 contained in the given certificate in the X509v3 Certificate
2552 Extensions.
2553
2554 @strong{Returns:} @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  and updates  @code{ret_size} if
2555  @code{ret_size} is not enough to hold the distribution point, or the
2556 type of the distribution point if everything was ok. The type is
2557 one of the enumerated @code{gnutls_x509_subject_alt_name_t} .  If the
2558 certificate does not have an Alternative name with the specified
2559 sequence number then @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  is
2560 returned.
2561 @end deftypefun
2562
2563 @subheading gnutls_x509_crt_get_dn
2564 @anchor{gnutls_x509_crt_get_dn}
2565 @deftypefun {int} {gnutls_x509_crt_get_dn} (gnutls_x509_crt_t @var{cert}, char * @var{buf}, size_t * @var{buf_size})
2566 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
2567
2568 @var{buf}: a pointer to a structure to hold the name (may be null)
2569
2570 @var{buf_size}: initially holds the size of  @code{buf} 
2571
2572 This function will copy the name of the Certificate in the provided
2573 buffer. The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as
2574 described in RFC4514. The output string will be ASCII or UTF-8
2575 encoded, depending on the certificate data.
2576
2577 If  @code{buf} is null then only the size will be filled. 
2578
2579 @strong{Returns:} @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  if the provided buffer is not
2580 long enough, and in that case the  @code{buf_size} will be updated
2581 with the required size.  On success 0 is returned.
2582 @end deftypefun
2583
2584 @subheading gnutls_x509_crt_get_dn2
2585 @anchor{gnutls_x509_crt_get_dn2}
2586 @deftypefun {int} {gnutls_x509_crt_get_dn2} (gnutls_x509_crt_t @var{cert}, gnutls_datum_t * @var{dn})
2587 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
2588
2589 @var{dn}: a pointer to a structure to hold the name
2590
2591 This function will allocate buffer and copy the name of the Certificate.
2592 The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as
2593 described in RFC4514. The output string will be ASCII or UTF-8
2594 encoded, depending on the certificate data.
2595
2596 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
2597 negative error value. and a negative error code on error.
2598
2599 @strong{Since:} 3.1.10
2600 @end deftypefun
2601
2602 @subheading gnutls_x509_crt_get_dn_by_oid
2603 @anchor{gnutls_x509_crt_get_dn_by_oid}
2604 @deftypefun {int} {gnutls_x509_crt_get_dn_by_oid} (gnutls_x509_crt_t @var{cert}, const char * @var{oid}, int @var{indx}, unsigned int @var{raw_flag}, void * @var{buf}, size_t * @var{buf_size})
2605 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
2606
2607 @var{oid}: holds an Object Identified in null terminated string
2608
2609 @var{indx}: In case multiple same OIDs exist in the RDN, this specifies which to send. Use (0) to get the first one.
2610
2611 @var{raw_flag}: If non-zero returns the raw DER data of the DN part.
2612
2613 @var{buf}: a pointer where the DN part will be copied (may be null).
2614
2615 @var{buf_size}: initially holds the size of  @code{buf} 
2616
2617 This function will extract the part of the name of the Certificate
2618 subject specified by the given OID. The output, if the raw flag is
2619 not used, will be encoded as described in RFC4514. Thus a string
2620 that is ASCII or UTF-8 encoded, depending on the certificate data.
2621
2622 Some helper macros with popular OIDs can be found in gnutls/x509.h
2623 If raw flag is (0), this function will only return known OIDs as
2624 text. Other OIDs will be DER encoded, as described in RFC4514 --
2625 in hex format with a '#' prefix.  You can check about known OIDs
2626 using @code{gnutls_x509_dn_oid_known()} .
2627
2628 If  @code{buf} is null then only the size will be filled. If the  @code{raw_flag} is not specified the output is always null terminated, although the
2629  @code{buf_size} will not include the null character.
2630
2631 @strong{Returns:} @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  if the provided buffer is not
2632 long enough, and in that case the  @code{buf_size} will be updated with
2633 the required size. @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  if there 
2634 are no data in the current index. On success 0 is returned.
2635 @end deftypefun
2636
2637 @subheading gnutls_x509_crt_get_dn_oid
2638 @anchor{gnutls_x509_crt_get_dn_oid}
2639 @deftypefun {int} {gnutls_x509_crt_get_dn_oid} (gnutls_x509_crt_t @var{cert}, int @var{indx}, void * @var{oid}, size_t * @var{oid_size})
2640 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
2641
2642 @var{indx}: This specifies which OID to return. Use (0) to get the first one.
2643
2644 @var{oid}: a pointer to a buffer to hold the OID (may be null)
2645
2646 @var{oid_size}: initially holds the size of  @code{oid} 
2647
2648 This function will extract the OIDs of the name of the Certificate
2649 subject specified by the given index.
2650
2651 If  @code{oid} is null then only the size will be filled. The  @code{oid} returned will be null terminated, although  @code{oid_size} will not
2652 account for the trailing null.
2653
2654 @strong{Returns:} @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  if the provided buffer is not
2655 long enough, and in that case the  @code{buf_size} will be updated with
2656 the required size. @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  if there 
2657 are no data in the current index. On success 0 is returned.
2658 @end deftypefun
2659
2660 @subheading gnutls_x509_crt_get_expiration_time
2661 @anchor{gnutls_x509_crt_get_expiration_time}
2662 @deftypefun {time_t} {gnutls_x509_crt_get_expiration_time} (gnutls_x509_crt_t @var{cert})
2663 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
2664
2665 This function will return the time this Certificate was or will be
2666 expired.
2667
2668 The no well defined expiration time can be checked against with the
2669 @code{GNUTLS_X509_NO_WELL_DEFINED_EXPIRATION}  macro.
2670
2671 @strong{Returns:} expiration time, or (time_t)-1 on error.
2672 @end deftypefun
2673
2674 @subheading gnutls_x509_crt_get_extension_by_oid
2675 @anchor{gnutls_x509_crt_get_extension_by_oid}
2676 @deftypefun {int} {gnutls_x509_crt_get_extension_by_oid} (gnutls_x509_crt_t @var{cert}, const char * @var{oid}, int @var{indx}, void * @var{buf}, size_t * @var{buf_size}, unsigned int * @var{critical})
2677 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
2678
2679 @var{oid}: holds an Object Identified in null terminated string
2680
2681 @var{indx}: In case multiple same OIDs exist in the extensions, this specifies which to send. Use (0) to get the first one.
2682
2683 @var{buf}: a pointer to a structure to hold the name (may be null)
2684
2685 @var{buf_size}: initially holds the size of  @code{buf} 
2686
2687 @var{critical}: will be non-zero if the extension is marked as critical
2688
2689 This function will return the extension specified by the OID in the
2690 certificate.  The extensions will be returned as binary data DER
2691 encoded, in the provided buffer.
2692
2693 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned,
2694 otherwise a negative error code is returned. If the certificate does not
2695 contain the specified extension
2696 GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned.
2697 @end deftypefun
2698
2699 @subheading gnutls_x509_crt_get_extension_data
2700 @anchor{gnutls_x509_crt_get_extension_data}
2701 @deftypefun {int} {gnutls_x509_crt_get_extension_data} (gnutls_x509_crt_t @var{cert}, int @var{indx}, void * @var{data}, size_t * @var{sizeof_data})
2702 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
2703
2704 @var{indx}: Specifies which extension OID to send. Use (0) to get the first one.
2705
2706 @var{data}: a pointer to a structure to hold the data (may be null)
2707
2708 @var{sizeof_data}: initially holds the size of  @code{data} 
2709
2710 This function will return the requested extension data in the
2711 certificate.  The extension data will be stored in the
2712 provided buffer.
2713
2714 Use @code{gnutls_x509_crt_get_extension_info()}  to extract the OID and
2715 critical flag.  Use @code{gnutls_x509_crt_get_extension_by_oid()}  instead,
2716 if you want to get data indexed by the extension OID rather than
2717 sequence.
2718
2719 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned,
2720 otherwise a negative error code is returned.  If you have reached the
2721 last extension available @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
2722 will be returned.
2723 @end deftypefun
2724
2725 @subheading gnutls_x509_crt_get_extension_data2
2726 @anchor{gnutls_x509_crt_get_extension_data2}
2727 @deftypefun {int} {gnutls_x509_crt_get_extension_data2} (gnutls_x509_crt_t @var{cert}, unsigned @var{indx}, gnutls_datum_t * @var{data})
2728 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
2729
2730 @var{indx}: Specifies which extension OID to read. Use (0) to get the first one.
2731
2732 @var{data}: will contain the extension DER-encoded data
2733
2734 This function will return the requested by the index extension data in the
2735 certificate.  The extension data will be allocated using
2736 @code{gnutls_malloc()} .
2737
2738 Use @code{gnutls_x509_crt_get_extension_info()}  to extract the OID.
2739
2740 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned,
2741 otherwise a negative error code is returned.  If you have reached the
2742 last extension available @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
2743 will be returned.
2744 @end deftypefun
2745
2746 @subheading gnutls_x509_crt_get_extension_info
2747 @anchor{gnutls_x509_crt_get_extension_info}
2748 @deftypefun {int} {gnutls_x509_crt_get_extension_info} (gnutls_x509_crt_t @var{cert}, int @var{indx}, void * @var{oid}, size_t * @var{oid_size}, unsigned int * @var{critical})
2749 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
2750
2751 @var{indx}: Specifies which extension OID to send. Use (0) to get the first one.
2752
2753 @var{oid}: a pointer to a structure to hold the OID
2754
2755 @var{oid_size}: initially holds the maximum size of  @code{oid} , on return
2756 holds actual size of  @code{oid} .
2757
2758 @var{critical}: output variable with critical flag, may be NULL.
2759
2760 This function will return the requested extension OID in the
2761 certificate, and the critical flag for it.  The extension OID will
2762 be stored as a string in the provided buffer.  Use
2763 @code{gnutls_x509_crt_get_extension()}  to extract the data.
2764
2765 If the buffer provided is not long enough to hold the output, then
2766  @code{oid_size} is updated and @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  will be
2767 returned. The  @code{oid} returned will be null terminated, although 
2768  @code{oid_size} will not account for the trailing null.
2769
2770 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned,
2771 otherwise a negative error code is returned.  If you have reached the
2772 last extension available @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
2773 will be returned.
2774 @end deftypefun
2775
2776 @subheading gnutls_x509_crt_get_extension_oid
2777 @anchor{gnutls_x509_crt_get_extension_oid}
2778 @deftypefun {int} {gnutls_x509_crt_get_extension_oid} (gnutls_x509_crt_t @var{cert}, int @var{indx}, void * @var{oid}, size_t * @var{oid_size})
2779 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
2780
2781 @var{indx}: Specifies which extension OID to send. Use (0) to get the first one.
2782
2783 @var{oid}: a pointer to a structure to hold the OID (may be null)
2784
2785 @var{oid_size}: initially holds the size of  @code{oid} 
2786
2787 This function will return the requested extension OID in the certificate.
2788 The extension OID will be stored as a string in the provided buffer.
2789
2790 The  @code{oid} returned will be null terminated, although  @code{oid_size} will not
2791 account for the trailing null.
2792
2793 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned,
2794 otherwise a negative error code is returned.  If you have reached the
2795 last extension available @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
2796 will be returned.
2797 @end deftypefun
2798
2799 @subheading gnutls_x509_crt_get_fingerprint
2800 @anchor{gnutls_x509_crt_get_fingerprint}
2801 @deftypefun {int} {gnutls_x509_crt_get_fingerprint} (gnutls_x509_crt_t @var{cert}, gnutls_digest_algorithm_t @var{algo}, void * @var{buf}, size_t * @var{buf_size})
2802 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
2803
2804 @var{algo}: is a digest algorithm
2805
2806 @var{buf}: a pointer to a structure to hold the fingerprint (may be null)
2807
2808 @var{buf_size}: initially holds the size of  @code{buf} 
2809
2810 This function will calculate and copy the certificate's fingerprint
2811 in the provided buffer. The fingerprint is a hash of the DER-encoded
2812 data of the certificate.
2813
2814 If the buffer is null then only the size will be filled.
2815
2816 @strong{Returns:} @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  if the provided buffer is
2817 not long enough, and in that case the *buf_size will be updated
2818 with the required size.  On success 0 is returned.
2819 @end deftypefun
2820
2821 @subheading gnutls_x509_crt_get_issuer
2822 @anchor{gnutls_x509_crt_get_issuer}
2823 @deftypefun {int} {gnutls_x509_crt_get_issuer} (gnutls_x509_crt_t @var{cert}, gnutls_x509_dn_t * @var{dn})
2824 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
2825
2826 @var{dn}: output variable with pointer to uint8_t DN
2827
2828 Return the Certificate's Issuer DN as a @code{gnutls_x509_dn_t}  data type,
2829 that can be decoded using @code{gnutls_x509_dn_get_rdn_ava()} . 
2830
2831 Note that  @code{dn} should be treated as constant. Because it points 
2832 into the  @code{cert} object, you should not use  @code{dn} after  @code{cert} is
2833 deallocated.
2834
2835 @strong{Returns:} Returns 0 on success, or an error code.
2836 @end deftypefun
2837
2838 @subheading gnutls_x509_crt_get_issuer_alt_name
2839 @anchor{gnutls_x509_crt_get_issuer_alt_name}
2840 @deftypefun {int} {gnutls_x509_crt_get_issuer_alt_name} (gnutls_x509_crt_t @var{cert}, unsigned int @var{seq}, void * @var{ian}, size_t * @var{ian_size}, unsigned int * @var{critical})
2841 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
2842
2843 @var{seq}: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.)
2844
2845 @var{ian}: is the place where the alternative name will be copied to
2846
2847 @var{ian_size}: holds the size of ian.
2848
2849 @var{critical}: will be non-zero if the extension is marked as critical (may be null)
2850
2851 This function retrieves the Issuer Alternative Name (2.5.29.18),
2852 contained in the given certificate in the X509v3 Certificate
2853 Extensions.
2854
2855 When the SAN type is otherName, it will extract the data in the
2856 otherName's value field, and @code{GNUTLS_SAN_OTHERNAME}  is returned.
2857 You may use @code{gnutls_x509_crt_get_subject_alt_othername_oid()}  to get
2858 the corresponding OID and the "virtual" SAN types (e.g.,
2859 @code{GNUTLS_SAN_OTHERNAME_XMPP} ).
2860
2861 If an otherName OID is known, the data will be decoded.  Otherwise
2862 the returned data will be DER encoded, and you will have to decode
2863 it yourself.  Currently, only the RFC 3920 id-on-xmppAddr Issuer
2864 AltName is recognized.
2865
2866 @strong{Returns:} the alternative issuer name type on success, one of the
2867 enumerated @code{gnutls_x509_subject_alt_name_t} .  It will return
2868 @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  if  @code{ian_size} is not large enough
2869 to hold the value.  In that case  @code{ian_size} will be updated with
2870 the required size.  If the certificate does not have an
2871 Alternative name with the specified sequence number then
2872 @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  is returned.
2873
2874 @strong{Since:} 2.10.0
2875 @end deftypefun
2876
2877 @subheading gnutls_x509_crt_get_issuer_alt_name2
2878 @anchor{gnutls_x509_crt_get_issuer_alt_name2}
2879 @deftypefun {int} {gnutls_x509_crt_get_issuer_alt_name2} (gnutls_x509_crt_t @var{cert}, unsigned int @var{seq}, void * @var{ian}, size_t * @var{ian_size}, unsigned int * @var{ian_type}, unsigned int * @var{critical})
2880 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
2881
2882 @var{seq}: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.)
2883
2884 @var{ian}: is the place where the alternative name will be copied to
2885
2886 @var{ian_size}: holds the size of ret.
2887
2888 @var{ian_type}: holds the type of the alternative name (one of gnutls_x509_subject_alt_name_t).
2889
2890 @var{critical}: will be non-zero if the extension is marked as critical (may be null)
2891
2892 This function will return the alternative names, contained in the
2893 given certificate. It is the same as
2894 @code{gnutls_x509_crt_get_issuer_alt_name()}  except for the fact that it
2895 will return the type of the alternative name in  @code{ian_type} even if
2896 the function fails for some reason (i.e.  the buffer provided is
2897 not enough).
2898
2899 @strong{Returns:} the alternative issuer name type on success, one of the
2900 enumerated @code{gnutls_x509_subject_alt_name_t} .  It will return
2901 @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  if  @code{ian_size} is not large enough
2902 to hold the value.  In that case  @code{ian_size} will be updated with
2903 the required size.  If the certificate does not have an
2904 Alternative name with the specified sequence number then
2905 @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  is returned.
2906
2907 @strong{Since:} 2.10.0
2908 @end deftypefun
2909
2910 @subheading gnutls_x509_crt_get_issuer_alt_othername_oid
2911 @anchor{gnutls_x509_crt_get_issuer_alt_othername_oid}
2912 @deftypefun {int} {gnutls_x509_crt_get_issuer_alt_othername_oid} (gnutls_x509_crt_t @var{cert}, unsigned int @var{seq}, void * @var{ret}, size_t * @var{ret_size})
2913 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
2914
2915 @var{seq}: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.)
2916
2917 @var{ret}: is the place where the otherName OID will be copied to
2918
2919 @var{ret_size}: holds the size of ret.
2920
2921 This function will extract the type OID of an otherName Subject
2922 Alternative Name, contained in the given certificate, and return
2923 the type as an enumerated element.
2924
2925 If  @code{oid} is null then only the size will be filled. The  @code{oid} returned will be null terminated, although  @code{oid_size} will not
2926 account for the trailing null.
2927
2928 This function is only useful if
2929 @code{gnutls_x509_crt_get_issuer_alt_name()}  returned
2930 @code{GNUTLS_SAN_OTHERNAME} .
2931
2932 @strong{Returns:} the alternative issuer name type on success, one of the
2933 enumerated gnutls_x509_subject_alt_name_t.  For supported OIDs, it
2934 will return one of the virtual (GNUTLS_SAN_OTHERNAME_*) types,
2935 e.g. @code{GNUTLS_SAN_OTHERNAME_XMPP} , and @code{GNUTLS_SAN_OTHERNAME}  for
2936 unknown OIDs.  It will return @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  if
2937  @code{ret_size} is not large enough to hold the value.  In that case
2938  @code{ret_size} will be updated with the required size.  If the
2939 certificate does not have an Alternative name with the specified
2940 sequence number and with the otherName type then
2941 @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  is returned.
2942
2943 @strong{Since:} 2.10.0
2944 @end deftypefun
2945
2946 @subheading gnutls_x509_crt_get_issuer_dn
2947 @anchor{gnutls_x509_crt_get_issuer_dn}
2948 @deftypefun {int} {gnutls_x509_crt_get_issuer_dn} (gnutls_x509_crt_t @var{cert}, char * @var{buf}, size_t * @var{buf_size})
2949 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
2950
2951 @var{buf}: a pointer to a structure to hold the name (may be null)
2952
2953 @var{buf_size}: initially holds the size of  @code{buf} 
2954
2955 This function will copy the name of the Certificate issuer in the
2956 provided buffer. The name will be in the form
2957 "C=xxxx,O=yyyy,CN=zzzz" as described in RFC4514. The output string
2958 will be ASCII or UTF-8 encoded, depending on the certificate data.
2959
2960 If  @code{buf} is null then only the size will be filled. 
2961
2962 @strong{Returns:} GNUTLS_E_SHORT_MEMORY_BUFFER if the provided buffer is not
2963 long enough, and in that case the  @code{buf_size} will be updated with
2964 the required size.  On success 0 is returned.
2965 @end deftypefun
2966
2967 @subheading gnutls_x509_crt_get_issuer_dn2
2968 @anchor{gnutls_x509_crt_get_issuer_dn2}
2969 @deftypefun {int} {gnutls_x509_crt_get_issuer_dn2} (gnutls_x509_crt_t @var{cert}, gnutls_datum_t * @var{dn})
2970 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
2971
2972 @var{dn}: a pointer to a structure to hold the name
2973
2974 This function will allocate buffer and copy the name of issuer of the Certificate.
2975 The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as
2976 described in RFC4514. The output string will be ASCII or UTF-8
2977 encoded, depending on the certificate data.
2978
2979 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
2980 negative error value. and a negative error code on error.
2981
2982 @strong{Since:} 3.1.10
2983 @end deftypefun
2984
2985 @subheading gnutls_x509_crt_get_issuer_dn_by_oid
2986 @anchor{gnutls_x509_crt_get_issuer_dn_by_oid}
2987 @deftypefun {int} {gnutls_x509_crt_get_issuer_dn_by_oid} (gnutls_x509_crt_t @var{cert}, const char * @var{oid}, int @var{indx}, unsigned int @var{raw_flag}, void * @var{buf}, size_t * @var{buf_size})
2988 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
2989
2990 @var{oid}: holds an Object Identified in null terminated string
2991
2992 @var{indx}: In case multiple same OIDs exist in the RDN, this specifies which to send. Use (0) to get the first one.
2993
2994 @var{raw_flag}: If non-zero returns the raw DER data of the DN part.
2995
2996 @var{buf}: a pointer to a structure to hold the name (may be null)
2997
2998 @var{buf_size}: initially holds the size of  @code{buf} 
2999
3000 This function will extract the part of the name of the Certificate
3001 issuer specified by the given OID. The output, if the raw flag is not
3002 used, will be encoded as described in RFC4514. Thus a string that is
3003 ASCII or UTF-8 encoded, depending on the certificate data.
3004
3005 Some helper macros with popular OIDs can be found in gnutls/x509.h
3006 If raw flag is (0), this function will only return known OIDs as
3007 text. Other OIDs will be DER encoded, as described in RFC4514 --
3008 in hex format with a '#' prefix.  You can check about known OIDs
3009 using @code{gnutls_x509_dn_oid_known()} .
3010
3011 If  @code{buf} is null then only the size will be filled. If the  @code{raw_flag} is not specified the output is always null terminated, although the
3012  @code{buf_size} will not include the null character.
3013
3014 @strong{Returns:} @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  if the provided buffer is not
3015 long enough, and in that case the  @code{buf_size} will be updated with
3016 the required size. @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  if there 
3017 are no data in the current index. On success 0 is returned.
3018 @end deftypefun
3019
3020 @subheading gnutls_x509_crt_get_issuer_dn_oid
3021 @anchor{gnutls_x509_crt_get_issuer_dn_oid}
3022 @deftypefun {int} {gnutls_x509_crt_get_issuer_dn_oid} (gnutls_x509_crt_t @var{cert}, int @var{indx}, void * @var{oid}, size_t * @var{oid_size})
3023 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
3024
3025 @var{indx}: This specifies which OID to return. Use (0) to get the first one.
3026
3027 @var{oid}: a pointer to a buffer to hold the OID (may be null)
3028
3029 @var{oid_size}: initially holds the size of  @code{oid} 
3030
3031 This function will extract the OIDs of the name of the Certificate
3032 issuer specified by the given index.
3033
3034 If  @code{oid} is null then only the size will be filled. The  @code{oid} returned will be null terminated, although  @code{oid_size} will not
3035 account for the trailing null.
3036
3037 @strong{Returns:} @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  if the provided buffer is not
3038 long enough, and in that case the  @code{buf_size} will be updated with
3039 the required size. @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  if there 
3040 are no data in the current index. On success 0 is returned.
3041 @end deftypefun
3042
3043 @subheading gnutls_x509_crt_get_issuer_unique_id
3044 @anchor{gnutls_x509_crt_get_issuer_unique_id}
3045 @deftypefun {int} {gnutls_x509_crt_get_issuer_unique_id} (gnutls_x509_crt_t @var{crt}, char * @var{buf}, size_t * @var{buf_size})
3046 @var{crt}: Holds the certificate
3047
3048 @var{buf}: user allocated memory buffer, will hold the unique id
3049
3050 @var{buf_size}: size of user allocated memory buffer (on input), will hold
3051 actual size of the unique ID on return.
3052
3053 This function will extract the issuerUniqueID value (if present) for
3054 the given certificate.
3055
3056 If the user allocated memory buffer is not large enough to hold the
3057 full subjectUniqueID, then a GNUTLS_E_SHORT_MEMORY_BUFFER error will be
3058 returned, and buf_size will be set to the actual length.
3059
3060 @strong{Returns:} @code{GNUTLS_E_SUCCESS}  on success, otherwise a negative error code.
3061
3062 @strong{Since:} 2.12.0
3063 @end deftypefun
3064
3065 @subheading gnutls_x509_crt_get_key_id
3066 @anchor{gnutls_x509_crt_get_key_id}
3067 @deftypefun {int} {gnutls_x509_crt_get_key_id} (gnutls_x509_crt_t @var{crt}, unsigned int @var{flags}, unsigned char * @var{output_data}, size_t * @var{output_data_size})
3068 @var{crt}: Holds the certificate
3069
3070 @var{flags}: should be 0 for now
3071
3072 @var{output_data}: will contain the key ID
3073
3074 @var{output_data_size}: holds the size of output_data (and will be
3075 replaced by the actual size of parameters)
3076
3077 This function will return a unique ID that depends on the public
3078 key parameters. This ID can be used in checking whether a
3079 certificate corresponds to the given private key.
3080
3081 If the buffer provided is not long enough to hold the output, then
3082 *output_data_size is updated and GNUTLS_E_SHORT_MEMORY_BUFFER will
3083 be returned.  The output will normally be a SHA-1 hash output,
3084 which is 20 bytes.
3085
3086 @strong{Returns:} In case of failure a negative error code will be
3087 returned, and 0 on success.
3088 @end deftypefun
3089
3090 @subheading gnutls_x509_crt_get_key_purpose_oid
3091 @anchor{gnutls_x509_crt_get_key_purpose_oid}
3092 @deftypefun {int} {gnutls_x509_crt_get_key_purpose_oid} (gnutls_x509_crt_t @var{cert}, int @var{indx}, void * @var{oid}, size_t * @var{oid_size}, unsigned int * @var{critical})
3093 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
3094
3095 @var{indx}: This specifies which OID to return. Use (0) to get the first one.
3096
3097 @var{oid}: a pointer to a buffer to hold the OID (may be null)
3098
3099 @var{oid_size}: initially holds the size of  @code{oid} 
3100
3101 @var{critical}: output flag to indicate criticality of extension
3102
3103 This function will extract the key purpose OIDs of the Certificate
3104 specified by the given index.  These are stored in the Extended Key
3105 Usage extension (2.5.29.37) See the GNUTLS_KP_* definitions for
3106 human readable names.
3107
3108 If  @code{oid} is null then only the size will be filled. The  @code{oid} returned will be null terminated, although  @code{oid_size} will not
3109 account for the trailing null.
3110
3111 @strong{Returns:} @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  if the provided buffer is
3112 not long enough, and in that case the *oid_size will be updated
3113 with the required size.  On success 0 is returned.
3114 @end deftypefun
3115
3116 @subheading gnutls_x509_crt_get_key_usage
3117 @anchor{gnutls_x509_crt_get_key_usage}
3118 @deftypefun {int} {gnutls_x509_crt_get_key_usage} (gnutls_x509_crt_t @var{cert}, unsigned int * @var{key_usage}, unsigned int * @var{critical})
3119 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
3120
3121 @var{key_usage}: where the key usage bits will be stored
3122
3123 @var{critical}: will be non-zero if the extension is marked as critical
3124
3125 This function will return certificate's key usage, by reading the
3126 keyUsage X.509 extension (2.5.29.15). The key usage value will ORed
3127 values of the: @code{GNUTLS_KEY_DIGITAL_SIGNATURE} ,
3128 @code{GNUTLS_KEY_NON_REPUDIATION} , @code{GNUTLS_KEY_KEY_ENCIPHERMENT} ,
3129 @code{GNUTLS_KEY_DATA_ENCIPHERMENT} , @code{GNUTLS_KEY_KEY_AGREEMENT} ,
3130 @code{GNUTLS_KEY_KEY_CERT_SIGN} , @code{GNUTLS_KEY_CRL_SIGN} ,
3131 @code{GNUTLS_KEY_ENCIPHER_ONLY} , @code{GNUTLS_KEY_DECIPHER_ONLY} .
3132
3133 @strong{Returns:} the certificate key usage, or a negative error code in case of
3134 parsing error.  If the certificate does not contain the keyUsage
3135 extension @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  will be
3136 returned.
3137 @end deftypefun
3138
3139 @subheading gnutls_x509_crt_get_name_constraints
3140 @anchor{gnutls_x509_crt_get_name_constraints}
3141 @deftypefun {int} {gnutls_x509_crt_get_name_constraints} (gnutls_x509_crt_t @var{crt}, gnutls_x509_name_constraints_t @var{nc}, unsigned int @var{flags}, unsigned int * @var{critical})
3142 @var{crt}: should contain a @code{gnutls_x509_crt_t}  structure
3143
3144 @var{nc}: The nameconstraints intermediate structure
3145
3146 @var{flags}: zero or @code{GNUTLS_NAME_CONSTRAINTS_FLAG_APPEND} 
3147
3148 @var{critical}: the extension status
3149
3150 This function will return an intermediate structure containing
3151 the name constraints of the provided CA certificate. That
3152 structure can be used in combination with @code{gnutls_x509_name_constraints_check()} 
3153 to verify whether a server's name is in accordance with the constraints.
3154
3155 When the  @code{flags} is set to @code{GNUTLS_NAME_CONSTRAINTS_FLAG_APPEND} , then if 
3156 the  @code{nc} structure is empty
3157 this function will behave identically as if the flag was not set.
3158 Otherwise if there are elements in the  @code{nc} structure then only the
3159 excluded constraints will be appended to the constraints.
3160
3161 Note that  @code{nc} must be initialized prior to calling this function.
3162
3163 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
3164 if the extension is not present, otherwise a negative error value.
3165
3166 @strong{Since:} 3.3.0
3167 @end deftypefun
3168
3169 @subheading gnutls_x509_crt_get_pk_algorithm
3170 @anchor{gnutls_x509_crt_get_pk_algorithm}
3171 @deftypefun {int} {gnutls_x509_crt_get_pk_algorithm} (gnutls_x509_crt_t @var{cert}, unsigned int * @var{bits})
3172 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
3173
3174 @var{bits}: if bits is non null it will hold the size of the parameters' in bits
3175
3176 This function will return the public key algorithm of an X.509
3177 certificate.
3178
3179 If bits is non null, it should have enough size to hold the parameters
3180 size in bits. For RSA the bits returned is the modulus.
3181 For DSA the bits returned are of the public
3182 exponent.
3183
3184 @strong{Returns:} a member of the @code{gnutls_pk_algorithm_t}  enumeration on
3185 success, or a negative error code on error.
3186 @end deftypefun
3187
3188 @subheading gnutls_x509_crt_get_pk_dsa_raw
3189 @anchor{gnutls_x509_crt_get_pk_dsa_raw}
3190 @deftypefun {int} {gnutls_x509_crt_get_pk_dsa_raw} (gnutls_x509_crt_t @var{crt}, gnutls_datum_t * @var{p}, gnutls_datum_t * @var{q}, gnutls_datum_t * @var{g}, gnutls_datum_t * @var{y})
3191 @var{crt}: Holds the certificate
3192
3193 @var{p}: will hold the p
3194
3195 @var{q}: will hold the q
3196
3197 @var{g}: will hold the g
3198
3199 @var{y}: will hold the y
3200
3201 This function will export the DSA public key's parameters found in
3202 the given certificate.  The new parameters will be allocated using
3203 @code{gnutls_malloc()}  and will be stored in the appropriate datum.
3204
3205 @strong{Returns:} @code{GNUTLS_E_SUCCESS}  on success, otherwise a negative error code.
3206 @end deftypefun
3207
3208 @subheading gnutls_x509_crt_get_pk_rsa_raw
3209 @anchor{gnutls_x509_crt_get_pk_rsa_raw}
3210 @deftypefun {int} {gnutls_x509_crt_get_pk_rsa_raw} (gnutls_x509_crt_t @var{crt}, gnutls_datum_t * @var{m}, gnutls_datum_t * @var{e})
3211 @var{crt}: Holds the certificate
3212
3213 @var{m}: will hold the modulus
3214
3215 @var{e}: will hold the public exponent
3216
3217 This function will export the RSA public key's parameters found in
3218 the given structure.  The new parameters will be allocated using
3219 @code{gnutls_malloc()}  and will be stored in the appropriate datum.
3220
3221 @strong{Returns:} @code{GNUTLS_E_SUCCESS}  on success, otherwise a negative error code.
3222 @end deftypefun
3223
3224 @subheading gnutls_x509_crt_get_policy
3225 @anchor{gnutls_x509_crt_get_policy}
3226 @deftypefun {int} {gnutls_x509_crt_get_policy} (gnutls_x509_crt_t @var{crt}, int @var{indx}, struct gnutls_x509_policy_st * @var{policy}, unsigned int * @var{critical})
3227 @var{crt}: should contain a @code{gnutls_x509_crt_t}  structure
3228
3229 @var{indx}: This specifies which policy to return. Use (0) to get the first one.
3230
3231 @var{policy}: A pointer to a policy structure.
3232
3233 @var{critical}: will be non-zero if the extension is marked as critical
3234
3235 This function will extract the certificate policy (extension 2.5.29.32) 
3236 specified by the given index. 
3237
3238 The policy returned by this function must be deinitialized by using
3239 @code{gnutls_x509_policy_release()} .
3240
3241 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
3242 if the extension is not present, otherwise a negative error value.
3243
3244 @strong{Since:} 3.1.5
3245 @end deftypefun
3246
3247 @subheading gnutls_x509_crt_get_private_key_usage_period
3248 @anchor{gnutls_x509_crt_get_private_key_usage_period}
3249 @deftypefun {int} {gnutls_x509_crt_get_private_key_usage_period} (gnutls_x509_crt_t @var{cert}, time_t * @var{activation}, time_t * @var{expiration}, unsigned int * @var{critical})
3250 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
3251
3252 @var{activation}: The activation time
3253
3254 @var{expiration}: The expiration time
3255
3256 @var{critical}: the extension status
3257
3258 This function will return the expiration and activation
3259 times of the private key of the certificate. It relies on
3260 the PKIX extension 2.5.29.16 being present.
3261
3262 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
3263 if the extension is not present, otherwise a negative error value.
3264 @end deftypefun
3265
3266 @subheading gnutls_x509_crt_get_proxy
3267 @anchor{gnutls_x509_crt_get_proxy}
3268 @deftypefun {int} {gnutls_x509_crt_get_proxy} (gnutls_x509_crt_t @var{cert}, unsigned int * @var{critical}, int * @var{pathlen}, char ** @var{policyLanguage}, char ** @var{policy}, size_t * @var{sizeof_policy})
3269 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
3270
3271 @var{critical}: will be non-zero if the extension is marked as critical
3272
3273 @var{pathlen}: pointer to output integer indicating path length (may be
3274 NULL), non-negative error codes indicate a present pCPathLenConstraint
3275 field and the actual value, -1 indicate that the field is absent.
3276
3277 @var{policyLanguage}: output variable with OID of policy language
3278
3279 @var{policy}: output variable with policy data
3280
3281 @var{sizeof_policy}: output variable size of policy data
3282
3283 This function will get information from a proxy certificate.  It
3284 reads the ProxyCertInfo X.509 extension (1.3.6.1.5.5.7.1.14).
3285
3286 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned,
3287 otherwise a negative error code is returned.
3288 @end deftypefun
3289
3290 @subheading gnutls_x509_crt_get_raw_dn
3291 @anchor{gnutls_x509_crt_get_raw_dn}
3292 @deftypefun {int} {gnutls_x509_crt_get_raw_dn} (gnutls_x509_crt_t @var{cert}, gnutls_datum_t * @var{dn})
3293 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
3294
3295 @var{dn}: will hold the starting point of the DN
3296
3297 This function will return a pointer to the DER encoded DN structure and
3298 the length. This points to allocated data that must be free'd using @code{gnutls_free()} .
3299
3300 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
3301 negative error value. or a negative error code on error.
3302 @end deftypefun
3303
3304 @subheading gnutls_x509_crt_get_raw_issuer_dn
3305 @anchor{gnutls_x509_crt_get_raw_issuer_dn}
3306 @deftypefun {int} {gnutls_x509_crt_get_raw_issuer_dn} (gnutls_x509_crt_t @var{cert}, gnutls_datum_t * @var{dn})
3307 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
3308
3309 @var{dn}: will hold the starting point of the DN
3310
3311 This function will return a pointer to the DER encoded DN structure
3312 and the length. This points to allocated data that must be free'd using @code{gnutls_free()} .
3313
3314 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
3315 negative error value.or a negative error code on error.
3316 @end deftypefun
3317
3318 @subheading gnutls_x509_crt_get_serial
3319 @anchor{gnutls_x509_crt_get_serial}
3320 @deftypefun {int} {gnutls_x509_crt_get_serial} (gnutls_x509_crt_t @var{cert}, void * @var{result}, size_t * @var{result_size})
3321 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
3322
3323 @var{result}: The place where the serial number will be copied
3324
3325 @var{result_size}: Holds the size of the result field.
3326
3327 This function will return the X.509 certificate's serial number.
3328 This is obtained by the X509 Certificate serialNumber field. Serial
3329 is not always a 32 or 64bit number. Some CAs use large serial
3330 numbers, thus it may be wise to handle it as something uint8_t.
3331
3332 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
3333 negative error value.
3334 @end deftypefun
3335
3336 @subheading gnutls_x509_crt_get_signature
3337 @anchor{gnutls_x509_crt_get_signature}
3338 @deftypefun {int} {gnutls_x509_crt_get_signature} (gnutls_x509_crt_t @var{cert}, char * @var{sig}, size_t * @var{sig_size})
3339 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
3340
3341 @var{sig}: a pointer where the signature part will be copied (may be null).
3342
3343 @var{sig_size}: initially holds the size of  @code{sig} 
3344
3345 This function will extract the signature field of a certificate.
3346
3347 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
3348 negative error value. and a negative error code on error.
3349 @end deftypefun
3350
3351 @subheading gnutls_x509_crt_get_signature_algorithm
3352 @anchor{gnutls_x509_crt_get_signature_algorithm}
3353 @deftypefun {int} {gnutls_x509_crt_get_signature_algorithm} (gnutls_x509_crt_t @var{cert})
3354 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
3355
3356 This function will return a value of the @code{gnutls_sign_algorithm_t} 
3357 enumeration that is the signature algorithm that has been used to
3358 sign this certificate.
3359
3360 @strong{Returns:} a @code{gnutls_sign_algorithm_t}  value, or a negative error code on
3361 error.
3362 @end deftypefun
3363
3364 @subheading gnutls_x509_crt_get_subject
3365 @anchor{gnutls_x509_crt_get_subject}
3366 @deftypefun {int} {gnutls_x509_crt_get_subject} (gnutls_x509_crt_t @var{cert}, gnutls_x509_dn_t * @var{dn})
3367 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
3368
3369 @var{dn}: output variable with pointer to uint8_t DN.
3370
3371 Return the Certificate's Subject DN as a @code{gnutls_x509_dn_t}  data type,
3372 that can be decoded using @code{gnutls_x509_dn_get_rdn_ava()} . 
3373
3374 Note that  @code{dn} should be treated as constant. Because it points 
3375 into the  @code{cert} object, you should not use  @code{dn} after  @code{cert} is
3376 deallocated.
3377
3378 @strong{Returns:} Returns 0 on success, or an error code.
3379 @end deftypefun
3380
3381 @subheading gnutls_x509_crt_get_subject_alt_name
3382 @anchor{gnutls_x509_crt_get_subject_alt_name}
3383 @deftypefun {int} {gnutls_x509_crt_get_subject_alt_name} (gnutls_x509_crt_t @var{cert}, unsigned int @var{seq}, void * @var{san}, size_t * @var{san_size}, unsigned int * @var{critical})
3384 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
3385
3386 @var{seq}: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.)
3387
3388 @var{san}: is the place where the alternative name will be copied to
3389
3390 @var{san_size}: holds the size of san.
3391
3392 @var{critical}: will be non-zero if the extension is marked as critical (may be null)
3393
3394 This function retrieves the Alternative Name (2.5.29.17), contained
3395 in the given certificate in the X509v3 Certificate Extensions.
3396
3397 When the SAN type is otherName, it will extract the data in the
3398 otherName's value field, and @code{GNUTLS_SAN_OTHERNAME}  is returned.
3399 You may use @code{gnutls_x509_crt_get_subject_alt_othername_oid()}  to get
3400 the corresponding OID and the "virtual" SAN types (e.g.,
3401 @code{GNUTLS_SAN_OTHERNAME_XMPP} ).
3402
3403 If an otherName OID is known, the data will be decoded.  Otherwise
3404 the returned data will be DER encoded, and you will have to decode
3405 it yourself.  Currently, only the RFC 3920 id-on-xmppAddr SAN is
3406 recognized.
3407
3408 @strong{Returns:} the alternative subject name type on success, one of the
3409 enumerated @code{gnutls_x509_subject_alt_name_t} .  It will return
3410 @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  if  @code{san_size} is not large enough to
3411 hold the value.  In that case  @code{san_size} will be updated with the
3412 required size.  If the certificate does not have an Alternative
3413 name with the specified sequence number then
3414 @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  is returned.
3415 @end deftypefun
3416
3417 @subheading gnutls_x509_crt_get_subject_alt_name2
3418 @anchor{gnutls_x509_crt_get_subject_alt_name2}
3419 @deftypefun {int} {gnutls_x509_crt_get_subject_alt_name2} (gnutls_x509_crt_t @var{cert}, unsigned int @var{seq}, void * @var{san}, size_t * @var{san_size}, unsigned int * @var{san_type}, unsigned int * @var{critical})
3420 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
3421
3422 @var{seq}: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.)
3423
3424 @var{san}: is the place where the alternative name will be copied to
3425
3426 @var{san_size}: holds the size of ret.
3427
3428 @var{san_type}: holds the type of the alternative name (one of gnutls_x509_subject_alt_name_t).
3429
3430 @var{critical}: will be non-zero if the extension is marked as critical (may be null)
3431
3432 This function will return the alternative names, contained in the
3433 given certificate. It is the same as
3434 @code{gnutls_x509_crt_get_subject_alt_name()}  except for the fact that it
3435 will return the type of the alternative name in  @code{san_type} even if
3436 the function fails for some reason (i.e.  the buffer provided is
3437 not enough).
3438
3439 @strong{Returns:} the alternative subject name type on success, one of the
3440 enumerated @code{gnutls_x509_subject_alt_name_t} .  It will return
3441 @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  if  @code{san_size} is not large enough
3442 to hold the value.  In that case  @code{san_size} will be updated with
3443 the required size.  If the certificate does not have an
3444 Alternative name with the specified sequence number then
3445 @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  is returned.
3446 @end deftypefun
3447
3448 @subheading gnutls_x509_crt_get_subject_alt_othername_oid
3449 @anchor{gnutls_x509_crt_get_subject_alt_othername_oid}
3450 @deftypefun {int} {gnutls_x509_crt_get_subject_alt_othername_oid} (gnutls_x509_crt_t @var{cert}, unsigned int @var{seq}, void * @var{oid}, size_t * @var{oid_size})
3451 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
3452
3453 @var{seq}: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.)
3454
3455 @var{oid}: is the place where the otherName OID will be copied to
3456
3457 @var{oid_size}: holds the size of ret.
3458
3459 This function will extract the type OID of an otherName Subject
3460 Alternative Name, contained in the given certificate, and return
3461 the type as an enumerated element.
3462
3463 This function is only useful if
3464 @code{gnutls_x509_crt_get_subject_alt_name()}  returned
3465 @code{GNUTLS_SAN_OTHERNAME} .
3466
3467 If  @code{oid} is null then only the size will be filled. The  @code{oid} returned will be null terminated, although  @code{oid_size} will not
3468 account for the trailing null.
3469
3470 @strong{Returns:} the alternative subject name type on success, one of the
3471 enumerated gnutls_x509_subject_alt_name_t.  For supported OIDs, it
3472 will return one of the virtual (GNUTLS_SAN_OTHERNAME_*) types,
3473 e.g. @code{GNUTLS_SAN_OTHERNAME_XMPP} , and @code{GNUTLS_SAN_OTHERNAME}  for
3474 unknown OIDs.  It will return @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  if
3475  @code{ian_size} is not large enough to hold the value.  In that case
3476  @code{ian_size} will be updated with the required size.  If the
3477 certificate does not have an Alternative name with the specified
3478 sequence number and with the otherName type then
3479 @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  is returned.
3480 @end deftypefun
3481
3482 @subheading gnutls_x509_crt_get_subject_key_id
3483 @anchor{gnutls_x509_crt_get_subject_key_id}
3484 @deftypefun {int} {gnutls_x509_crt_get_subject_key_id} (gnutls_x509_crt_t @var{cert}, void * @var{ret}, size_t * @var{ret_size}, unsigned int * @var{critical})
3485 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
3486
3487 @var{ret}: The place where the identifier will be copied
3488
3489 @var{ret_size}: Holds the size of the result field.
3490
3491 @var{critical}: will be non-zero if the extension is marked as critical (may be null)
3492
3493 This function will return the X.509v3 certificate's subject key
3494 identifier.  This is obtained by the X.509 Subject Key identifier
3495 extension field (2.5.29.14).
3496
3497 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
3498 if the extension is not present, otherwise a negative error value.
3499 @end deftypefun
3500
3501 @subheading gnutls_x509_crt_get_subject_unique_id
3502 @anchor{gnutls_x509_crt_get_subject_unique_id}
3503 @deftypefun {int} {gnutls_x509_crt_get_subject_unique_id} (gnutls_x509_crt_t @var{crt}, char * @var{buf}, size_t * @var{buf_size})
3504 @var{crt}: Holds the certificate
3505
3506 @var{buf}: user allocated memory buffer, will hold the unique id
3507
3508 @var{buf_size}: size of user allocated memory buffer (on input), will hold
3509 actual size of the unique ID on return.
3510
3511 This function will extract the subjectUniqueID value (if present) for
3512 the given certificate.
3513
3514 If the user allocated memory buffer is not large enough to hold the
3515 full subjectUniqueID, then a GNUTLS_E_SHORT_MEMORY_BUFFER error will be
3516 returned, and buf_size will be set to the actual length.
3517
3518 @strong{Returns:} @code{GNUTLS_E_SUCCESS}  on success, otherwise a negative error code.
3519 @end deftypefun
3520
3521 @subheading gnutls_x509_crt_get_version
3522 @anchor{gnutls_x509_crt_get_version}
3523 @deftypefun {int} {gnutls_x509_crt_get_version} (gnutls_x509_crt_t @var{cert})
3524 @var{cert}: should contain a @code{gnutls_x509_crt_t}  structure
3525
3526 This function will return the version of the specified Certificate.
3527
3528 @strong{Returns:} version of certificate, or a negative error code on error.
3529 @end deftypefun
3530
3531 @subheading gnutls_x509_crt_import
3532 @anchor{gnutls_x509_crt_import}
3533 @deftypefun {int} {gnutls_x509_crt_import} (gnutls_x509_crt_t @var{cert}, const gnutls_datum_t * @var{data}, gnutls_x509_crt_fmt_t @var{format})
3534 @var{cert}: The structure to store the parsed certificate.
3535
3536 @var{data}: The DER or PEM encoded certificate.
3537
3538 @var{format}: One of DER or PEM
3539
3540 This function will convert the given DER or PEM encoded Certificate
3541 to the native gnutls_x509_crt_t format. The output will be stored
3542 in  @code{cert} .
3543
3544 If the Certificate is PEM encoded it should have a header of "X509
3545 CERTIFICATE", or "CERTIFICATE".
3546
3547 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
3548 negative error value.
3549 @end deftypefun
3550
3551 @subheading gnutls_x509_crt_init
3552 @anchor{gnutls_x509_crt_init}
3553 @deftypefun {int} {gnutls_x509_crt_init} (gnutls_x509_crt_t * @var{cert})
3554 @var{cert}: The structure to be initialized
3555
3556 This function will initialize an X.509 certificate structure.
3557
3558 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
3559 negative error value.
3560 @end deftypefun
3561
3562 @subheading gnutls_x509_crt_list_import
3563 @anchor{gnutls_x509_crt_list_import}
3564 @deftypefun {int} {gnutls_x509_crt_list_import} (gnutls_x509_crt_t * @var{certs}, unsigned int * @var{cert_max}, const gnutls_datum_t * @var{data}, gnutls_x509_crt_fmt_t @var{format}, unsigned int @var{flags})
3565 @var{certs}: The structures to store the parsed certificate. Must not be initialized.
3566
3567 @var{cert_max}: Initially must hold the maximum number of certs. It will be updated with the number of certs available.
3568
3569 @var{data}: The PEM encoded certificate.
3570
3571 @var{format}: One of DER or PEM.
3572
3573 @var{flags}: must be (0) or an OR'd sequence of gnutls_certificate_import_flags.
3574
3575 This function will convert the given PEM encoded certificate list
3576 to the native gnutls_x509_crt_t format. The output will be stored
3577 in  @code{certs} .  They will be automatically initialized.
3578
3579 The flag @code{GNUTLS_X509_CRT_LIST_IMPORT_FAIL_IF_EXCEED}  will cause
3580 import to fail if the certificates in the provided buffer are more
3581 than the available structures. The @code{GNUTLS_X509_CRT_LIST_FAIL_IF_UNSORTED} 
3582 flag will cause the function to fail if the provided list is not
3583 sorted from subject to issuer.
3584
3585 If the Certificate is PEM encoded it should have a header of "X509
3586 CERTIFICATE", or "CERTIFICATE".
3587
3588 @strong{Returns:} the number of certificates read or a negative error value.
3589 @end deftypefun
3590
3591 @subheading gnutls_x509_crt_list_import2
3592 @anchor{gnutls_x509_crt_list_import2}
3593 @deftypefun {int} {gnutls_x509_crt_list_import2} (gnutls_x509_crt_t ** @var{certs}, unsigned int * @var{size}, const gnutls_datum_t * @var{data}, gnutls_x509_crt_fmt_t @var{format}, unsigned int @var{flags})
3594 @var{certs}: The structures to store the parsed certificate. Must not be initialized.
3595
3596 @var{size}: It will contain the size of the list.
3597
3598 @var{data}: The PEM encoded certificate.
3599
3600 @var{format}: One of DER or PEM.
3601
3602 @var{flags}: must be (0) or an OR'd sequence of gnutls_certificate_import_flags.
3603
3604 This function will convert the given PEM encoded certificate list
3605 to the native gnutls_x509_crt_t format. The output will be stored
3606 in  @code{certs} which will allocated and initialized.
3607
3608 If the Certificate is PEM encoded it should have a header of "X509
3609 CERTIFICATE", or "CERTIFICATE".
3610
3611 To deinitialize  @code{certs} , you need to deinitialize each crt structure
3612 independently, and use @code{gnutls_free()}  at
3613
3614 @strong{Returns:} the number of certificates read or a negative error value.
3615
3616 @strong{Since:} 3.0
3617 @end deftypefun
3618
3619 @subheading gnutls_x509_crt_list_verify
3620 @anchor{gnutls_x509_crt_list_verify}
3621 @deftypefun {int} {gnutls_x509_crt_list_verify} (const gnutls_x509_crt_t * @var{cert_list}, int @var{cert_list_length}, const gnutls_x509_crt_t * @var{CA_list}, int @var{CA_list_length}, const gnutls_x509_crl_t * @var{CRL_list}, int @var{CRL_list_length}, unsigned int @var{flags}, unsigned int * @var{verify})
3622 @var{cert_list}: is the certificate list to be verified
3623
3624 @var{cert_list_length}: holds the number of certificate in cert_list
3625
3626 @var{CA_list}: is the CA list which will be used in verification
3627
3628 @var{CA_list_length}: holds the number of CA certificate in CA_list
3629
3630 @var{CRL_list}: holds a list of CRLs.
3631
3632 @var{CRL_list_length}: the length of CRL list.
3633
3634 @var{flags}: Flags that may be used to change the verification algorithm. Use OR of the gnutls_certificate_verify_flags enumerations.
3635
3636 @var{verify}: will hold the certificate verification output.
3637
3638 This function will try to verify the given certificate list and
3639 return its status.  If no flags are specified (0), this function
3640 will use the basicConstraints (2.5.29.19) PKIX extension. This
3641 means that only a certificate authority is allowed to sign a
3642 certificate.
3643
3644 You must also check the peer's name in order to check if the verified
3645 certificate belongs to the actual peer.
3646
3647 The certificate verification output will be put in  @code{verify} and will
3648 be one or more of the gnutls_certificate_status_t enumerated
3649 elements bitwise or'd.  For a more detailed verification status use
3650 @code{gnutls_x509_crt_verify()}  per list element.
3651
3652 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
3653 negative error value.
3654 @end deftypefun
3655
3656 @subheading gnutls_x509_crt_print
3657 @anchor{gnutls_x509_crt_print}
3658 @deftypefun {int} {gnutls_x509_crt_print} (gnutls_x509_crt_t @var{cert}, gnutls_certificate_print_formats_t @var{format}, gnutls_datum_t * @var{out})
3659 @var{cert}: The structure to be printed
3660
3661 @var{format}: Indicate the format to use
3662
3663 @var{out}: Newly allocated datum with (0) terminated string.
3664
3665 This function will pretty print a X.509 certificate, suitable for
3666 display to a human.
3667
3668 If the format is @code{GNUTLS_CRT_PRINT_FULL}  then all fields of the
3669 certificate will be output, on multiple lines.  The
3670 @code{GNUTLS_CRT_PRINT_ONELINE}  format will generate one line with some
3671 selected fields, which is useful for logging purposes.
3672
3673 The output  @code{out} needs to be deallocated using @code{gnutls_free()} .
3674
3675 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
3676 negative error value.
3677 @end deftypefun
3678
3679 @subheading gnutls_x509_crt_set_activation_time
3680 @anchor{gnutls_x509_crt_set_activation_time}
3681 @deftypefun {int} {gnutls_x509_crt_set_activation_time} (gnutls_x509_crt_t @var{cert}, time_t @var{act_time})
3682 @var{cert}: a certificate of type @code{gnutls_x509_crt_t} 
3683
3684 @var{act_time}: The actual time
3685
3686 This function will set the time this Certificate was or will be
3687 activated.
3688
3689 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
3690 negative error value.
3691 @end deftypefun
3692
3693 @subheading gnutls_x509_crt_set_authority_info_access
3694 @anchor{gnutls_x509_crt_set_authority_info_access}
3695 @deftypefun {int} {gnutls_x509_crt_set_authority_info_access} (gnutls_x509_crt_t @var{crt}, int @var{what}, gnutls_datum_t * @var{data})
3696 @var{crt}: Holds the certificate
3697
3698 @var{what}: what data to get, a @code{gnutls_info_access_what_t}  type.
3699
3700 @var{data}: output data to be freed with @code{gnutls_free()} .
3701
3702 This function sets the Authority Information Access (AIA)
3703 extension, see RFC 5280 section 4.2.2.1 for more information.  
3704
3705 The type of data stored in  @code{data} is specified via  @code{what} which
3706 should be @code{gnutls_info_access_what_t}  values.
3707
3708 If  @code{what} is @code{GNUTLS_IA_OCSP_URI} ,  @code{data} will hold the OCSP URI.
3709 If  @code{what} is @code{GNUTLS_IA_CAISSUERS_URI} ,  @code{data} will hold the caIssuers
3710 URI.  
3711
3712 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
3713 negative error value.
3714
3715 @strong{Since:} 3.0
3716 @end deftypefun
3717
3718 @subheading gnutls_x509_crt_set_authority_key_id
3719 @anchor{gnutls_x509_crt_set_authority_key_id}
3720 @deftypefun {int} {gnutls_x509_crt_set_authority_key_id} (gnutls_x509_crt_t @var{cert}, const void * @var{id}, size_t @var{id_size})
3721 @var{cert}: a certificate of type @code{gnutls_x509_crt_t} 
3722
3723 @var{id}: The key ID
3724
3725 @var{id_size}: Holds the size of the key ID field.
3726
3727 This function will set the X.509 certificate's authority key ID extension.
3728 Only the keyIdentifier field can be set with this function.
3729
3730 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
3731 negative error value.
3732 @end deftypefun
3733
3734 @subheading gnutls_x509_crt_set_basic_constraints
3735 @anchor{gnutls_x509_crt_set_basic_constraints}
3736 @deftypefun {int} {gnutls_x509_crt_set_basic_constraints} (gnutls_x509_crt_t @var{crt}, unsigned int @var{ca}, int @var{pathLenConstraint})
3737 @var{crt}: a certificate of type @code{gnutls_x509_crt_t} 
3738
3739 @var{ca}: true(1) or false(0). Depending on the Certificate authority status.
3740
3741 @var{pathLenConstraint}: non-negative error codes indicate maximum length of path,
3742 and negative error codes indicate that the pathLenConstraints field should
3743 not be present.
3744
3745 This function will set the basicConstraints certificate extension.
3746
3747 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
3748 negative error value.
3749 @end deftypefun
3750
3751 @subheading gnutls_x509_crt_set_ca_status
3752 @anchor{gnutls_x509_crt_set_ca_status}
3753 @deftypefun {int} {gnutls_x509_crt_set_ca_status} (gnutls_x509_crt_t @var{crt}, unsigned int @var{ca})
3754 @var{crt}: a certificate of type @code{gnutls_x509_crt_t} 
3755
3756 @var{ca}: true(1) or false(0). Depending on the Certificate authority status.
3757
3758 This function will set the basicConstraints certificate extension.
3759 Use @code{gnutls_x509_crt_set_basic_constraints()}  if you want to control
3760 the pathLenConstraint field too.
3761
3762 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
3763 negative error value.
3764 @end deftypefun
3765
3766 @subheading gnutls_x509_crt_set_crl_dist_points
3767 @anchor{gnutls_x509_crt_set_crl_dist_points}
3768 @deftypefun {int} {gnutls_x509_crt_set_crl_dist_points} (gnutls_x509_crt_t @var{crt}, gnutls_x509_subject_alt_name_t @var{type}, const void * @var{data_string}, unsigned int @var{reason_flags})
3769 @var{crt}: a certificate of type @code{gnutls_x509_crt_t} 
3770
3771 @var{type}: is one of the gnutls_x509_subject_alt_name_t enumerations
3772
3773 @var{data_string}: The data to be set
3774
3775 @var{reason_flags}: revocation reasons
3776
3777 This function will set the CRL distribution points certificate extension.
3778
3779 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
3780 negative error value.
3781 @end deftypefun
3782
3783 @subheading gnutls_x509_crt_set_crl_dist_points2
3784 @anchor{gnutls_x509_crt_set_crl_dist_points2}
3785 @deftypefun {int} {gnutls_x509_crt_set_crl_dist_points2} (gnutls_x509_crt_t @var{crt}, gnutls_x509_subject_alt_name_t @var{type}, const void * @var{data}, unsigned int @var{data_size}, unsigned int @var{reason_flags})
3786 @var{crt}: a certificate of type @code{gnutls_x509_crt_t} 
3787
3788 @var{type}: is one of the gnutls_x509_subject_alt_name_t enumerations
3789
3790 @var{data}: The data to be set
3791
3792 @var{data_size}: The data size
3793
3794 @var{reason_flags}: revocation reasons
3795
3796 This function will set the CRL distribution points certificate extension.
3797
3798 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
3799 negative error value.
3800
3801 @strong{Since:} 2.6.0
3802 @end deftypefun
3803
3804 @subheading gnutls_x509_crt_set_crq
3805 @anchor{gnutls_x509_crt_set_crq}
3806 @deftypefun {int} {gnutls_x509_crt_set_crq} (gnutls_x509_crt_t @var{crt}, gnutls_x509_crq_t @var{crq})
3807 @var{crt}: a certificate of type @code{gnutls_x509_crt_t} 
3808
3809 @var{crq}: holds a certificate request
3810
3811 This function will set the name and public parameters as well as
3812 the extensions from the given certificate request to the certificate. 
3813 Only RSA keys are currently supported.
3814
3815 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
3816 negative error value.
3817 @end deftypefun
3818
3819 @subheading gnutls_x509_crt_set_crq_extensions
3820 @anchor{gnutls_x509_crt_set_crq_extensions}
3821 @deftypefun {int} {gnutls_x509_crt_set_crq_extensions} (gnutls_x509_crt_t @var{crt}, gnutls_x509_crq_t @var{crq})
3822 @var{crt}: a certificate of type @code{gnutls_x509_crt_t} 
3823
3824 @var{crq}: holds a certificate request
3825
3826 This function will set extensions from the given request to the
3827 certificate.
3828
3829 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
3830 negative error value.
3831
3832 @strong{Since:} 2.8.0
3833 @end deftypefun
3834
3835 @subheading gnutls_x509_crt_set_dn
3836 @anchor{gnutls_x509_crt_set_dn}
3837 @deftypefun {int} {gnutls_x509_crt_set_dn} (gnutls_x509_crt_t @var{crt}, const char * @var{dn}, const char ** @var{err})
3838 @var{crt}: a certificate of type @code{gnutls_x509_crt_t} 
3839
3840 @var{dn}: a comma separated DN string (RFC4514)
3841
3842 @var{err}: indicates the error position (if any)
3843
3844 This function will set the DN on the provided certificate.
3845 The input string should be plain ASCII or UTF-8 encoded.
3846
3847 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
3848 negative error value.
3849 @end deftypefun
3850
3851 @subheading gnutls_x509_crt_set_dn_by_oid
3852 @anchor{gnutls_x509_crt_set_dn_by_oid}
3853 @deftypefun {int} {gnutls_x509_crt_set_dn_by_oid} (gnutls_x509_crt_t @var{crt}, const char * @var{oid}, unsigned int @var{raw_flag}, const void * @var{name}, unsigned int @var{sizeof_name})
3854 @var{crt}: a certificate of type @code{gnutls_x509_crt_t} 
3855
3856 @var{oid}: holds an Object Identifier in a null terminated string
3857
3858 @var{raw_flag}: must be 0, or 1 if the data are DER encoded
3859
3860 @var{name}: a pointer to the name
3861
3862 @var{sizeof_name}: holds the size of  @code{name} 
3863
3864 This function will set the part of the name of the Certificate
3865 subject, specified by the given OID. The input string should be
3866 ASCII or UTF-8 encoded.
3867
3868 Some helper macros with popular OIDs can be found in gnutls/x509.h
3869 With this function you can only set the known OIDs. You can test
3870 for known OIDs using @code{gnutls_x509_dn_oid_known()} . For OIDs that are
3871 not known (by gnutls) you should properly DER encode your data,
3872 and call this function with  @code{raw_flag} set.
3873
3874 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
3875 negative error value.
3876 @end deftypefun
3877
3878 @subheading gnutls_x509_crt_set_expiration_time
3879 @anchor{gnutls_x509_crt_set_expiration_time}
3880 @deftypefun {int} {gnutls_x509_crt_set_expiration_time} (gnutls_x509_crt_t @var{cert}, time_t @var{exp_time})
3881 @var{cert}: a certificate of type @code{gnutls_x509_crt_t} 
3882
3883 @var{exp_time}: The actual time
3884
3885 This function will set the time this Certificate will expire.
3886 Setting an expiration time to (time_t)-1 or to @code{GNUTLS_X509_NO_WELL_DEFINED_EXPIRATION} 
3887 will set to the no well-defined expiration date value. 
3888
3889 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
3890 negative error value.
3891 @end deftypefun
3892
3893 @subheading gnutls_x509_crt_set_extension_by_oid
3894 @anchor{gnutls_x509_crt_set_extension_by_oid}
3895 @deftypefun {int} {gnutls_x509_crt_set_extension_by_oid} (gnutls_x509_crt_t @var{crt}, const char * @var{oid}, const void * @var{buf}, size_t @var{sizeof_buf}, unsigned int @var{critical})
3896 @var{crt}: a certificate of type @code{gnutls_x509_crt_t} 
3897
3898 @var{oid}: holds an Object Identified in null terminated string
3899
3900 @var{buf}: a pointer to a DER encoded data
3901
3902 @var{sizeof_buf}: holds the size of  @code{buf} 
3903
3904 @var{critical}: should be non-zero if the extension is to be marked as critical
3905
3906 This function will set an the extension, by the specified OID, in
3907 the certificate.  The extension data should be binary data DER
3908 encoded.
3909
3910 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
3911 negative error value.
3912 @end deftypefun
3913
3914 @subheading gnutls_x509_crt_set_issuer_alt_name
3915 @anchor{gnutls_x509_crt_set_issuer_alt_name}
3916 @deftypefun {int} {gnutls_x509_crt_set_issuer_alt_name} (gnutls_x509_crt_t @var{crt}, gnutls_x509_subject_alt_name_t @var{type}, const void * @var{data}, unsigned int @var{data_size}, unsigned int @var{flags})
3917 @var{crt}: a certificate of type @code{gnutls_x509_crt_t} 
3918
3919 @var{type}: is one of the gnutls_x509_subject_alt_name_t enumerations
3920
3921 @var{data}: The data to be set
3922
3923 @var{data_size}: The size of data to be set
3924
3925 @var{flags}: GNUTLS_FSAN_SET to clear previous data or GNUTLS_FSAN_APPEND to append. 
3926
3927 This function will set the issuer alternative name certificate
3928 extension. It can set the same types as @code{gnutls_x509_crt_set_subject_alt_name()} .
3929
3930 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
3931 negative error value.
3932
3933 @strong{Since:} 3.3.0
3934 @end deftypefun
3935
3936 @subheading gnutls_x509_crt_set_issuer_dn
3937 @anchor{gnutls_x509_crt_set_issuer_dn}
3938 @deftypefun {int} {gnutls_x509_crt_set_issuer_dn} (gnutls_x509_crt_t @var{crt}, const char * @var{dn}, const char ** @var{err})
3939 @var{crt}: a certificate of type @code{gnutls_x509_crt_t} 
3940
3941 @var{dn}: a comma separated DN string (RFC4514)
3942
3943 @var{err}: indicates the error position (if any)
3944
3945 This function will set the DN on the provided certificate.
3946 The input string should be plain ASCII or UTF-8 encoded.
3947
3948 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
3949 negative error value.
3950 @end deftypefun
3951
3952 @subheading gnutls_x509_crt_set_issuer_dn_by_oid
3953 @anchor{gnutls_x509_crt_set_issuer_dn_by_oid}
3954 @deftypefun {int} {gnutls_x509_crt_set_issuer_dn_by_oid} (gnutls_x509_crt_t @var{crt}, const char * @var{oid}, unsigned int @var{raw_flag}, const void * @var{name}, unsigned int @var{sizeof_name})
3955 @var{crt}: a certificate of type @code{gnutls_x509_crt_t} 
3956
3957 @var{oid}: holds an Object Identifier in a null terminated string
3958
3959 @var{raw_flag}: must be 0, or 1 if the data are DER encoded
3960
3961 @var{name}: a pointer to the name
3962
3963 @var{sizeof_name}: holds the size of  @code{name} 
3964
3965 This function will set the part of the name of the Certificate
3966 issuer, specified by the given OID.  The input string should be
3967 ASCII or UTF-8 encoded.
3968
3969 Some helper macros with popular OIDs can be found in gnutls/x509.h
3970 With this function you can only set the known OIDs. You can test
3971 for known OIDs using @code{gnutls_x509_dn_oid_known()} . For OIDs that are
3972 not known (by gnutls) you should properly DER encode your data,
3973 and call this function with  @code{raw_flag} set.
3974
3975 Normally you do not need to call this function, since the signing
3976 operation will copy the signer's name as the issuer of the
3977 certificate.
3978
3979 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
3980 negative error value.
3981 @end deftypefun
3982
3983 @subheading gnutls_x509_crt_set_key
3984 @anchor{gnutls_x509_crt_set_key}
3985 @deftypefun {int} {gnutls_x509_crt_set_key} (gnutls_x509_crt_t @var{crt}, gnutls_x509_privkey_t @var{key})
3986 @var{crt}: a certificate of type @code{gnutls_x509_crt_t} 
3987
3988 @var{key}: holds a private key
3989
3990 This function will set the public parameters from the given
3991 private key to the certificate. Only RSA keys are currently
3992 supported.
3993
3994 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
3995 negative error value.
3996 @end deftypefun
3997
3998 @subheading gnutls_x509_crt_set_key_purpose_oid
3999 @anchor{gnutls_x509_crt_set_key_purpose_oid}
4000 @deftypefun {int} {gnutls_x509_crt_set_key_purpose_oid} (gnutls_x509_crt_t @var{cert}, const void * @var{oid}, unsigned int @var{critical})
4001 @var{cert}: a certificate of type @code{gnutls_x509_crt_t} 
4002
4003 @var{oid}: a pointer to a null terminated string that holds the OID
4004
4005 @var{critical}: Whether this extension will be critical or not
4006
4007 This function will set the key purpose OIDs of the Certificate.
4008 These are stored in the Extended Key Usage extension (2.5.29.37)
4009 See the GNUTLS_KP_* definitions for human readable names.
4010
4011 Subsequent calls to this function will append OIDs to the OID list.
4012
4013 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned,
4014 otherwise a negative error code is returned.
4015 @end deftypefun
4016
4017 @subheading gnutls_x509_crt_set_key_usage
4018 @anchor{gnutls_x509_crt_set_key_usage}
4019 @deftypefun {int} {gnutls_x509_crt_set_key_usage} (gnutls_x509_crt_t @var{crt}, unsigned int @var{usage})
4020 @var{crt}: a certificate of type @code{gnutls_x509_crt_t} 
4021
4022 @var{usage}: an ORed sequence of the GNUTLS_KEY_* elements.
4023
4024 This function will set the keyUsage certificate extension.
4025
4026 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
4027 negative error value.
4028 @end deftypefun
4029
4030 @subheading gnutls_x509_crt_set_name_constraints
4031 @anchor{gnutls_x509_crt_set_name_constraints}
4032 @deftypefun {int} {gnutls_x509_crt_set_name_constraints} (gnutls_x509_crt_t @var{crt}, gnutls_x509_name_constraints_t @var{nc}, unsigned int @var{critical})
4033 @var{crt}: The certificate structure
4034
4035 @var{nc}: The nameconstraints structure
4036
4037 @var{critical}: whether this extension will be critical
4038
4039 This function will set the provided name constraints to
4040 the certificate extension list. This extension is always
4041 marked as critical.
4042
4043 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a negative error value.
4044
4045 @strong{Since:} 3.3.0
4046 @end deftypefun
4047
4048 @subheading gnutls_x509_crt_set_pin_function
4049 @anchor{gnutls_x509_crt_set_pin_function}
4050 @deftypefun {void} {gnutls_x509_crt_set_pin_function} (gnutls_x509_crt_t @var{crt}, gnutls_pin_callback_t @var{fn}, void * @var{userdata})
4051 @var{crt}: The certificate structure
4052
4053 @var{fn}: the callback
4054
4055 @var{userdata}: data associated with the callback
4056
4057 This function will set a callback function to be used when
4058 it is required to access a protected object. This function overrides 
4059 the global function set using @code{gnutls_pkcs11_set_pin_function()} .
4060
4061 Note that this callback is currently used only during the import
4062 of a PKCS @code{11}  certificate with @code{gnutls_x509_crt_import_pkcs11_url()} .
4063
4064 @strong{Since:} 3.1.0
4065 @end deftypefun
4066
4067 @subheading gnutls_x509_crt_set_policy
4068 @anchor{gnutls_x509_crt_set_policy}
4069 @deftypefun {int} {gnutls_x509_crt_set_policy} (gnutls_x509_crt_t @var{crt}, const struct gnutls_x509_policy_st * @var{policy}, unsigned int @var{critical})
4070 @var{crt}: should contain a @code{gnutls_x509_crt_t}  structure
4071
4072 @var{policy}: A pointer to a policy structure.
4073
4074 @var{critical}: use non-zero if the extension is marked as critical
4075
4076 This function will set the certificate policy extension (2.5.29.32).
4077 Multiple calls to this function append a new policy.
4078
4079 Note the maximum text size for the qualifier @code{GNUTLS_X509_QUALIFIER_NOTICE} 
4080 is 200 characters. This function will fail with @code{GNUTLS_E_INVALID_REQUEST} 
4081 if this is exceeded.
4082
4083 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
4084 negative error value.
4085
4086 @strong{Since:} 3.1.5
4087 @end deftypefun
4088
4089 @subheading gnutls_x509_crt_set_private_key_usage_period
4090 @anchor{gnutls_x509_crt_set_private_key_usage_period}
4091 @deftypefun {int} {gnutls_x509_crt_set_private_key_usage_period} (gnutls_x509_crt_t @var{crt}, time_t @var{activation}, time_t @var{expiration})
4092 @var{crt}: a certificate of type @code{gnutls_x509_crt_t} 
4093
4094 @var{activation}: The activation time
4095
4096 @var{expiration}: The expiration time
4097
4098 This function will set the private key usage period extension (2.5.29.16).
4099
4100 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
4101 negative error value.
4102 @end deftypefun
4103
4104 @subheading gnutls_x509_crt_set_proxy
4105 @anchor{gnutls_x509_crt_set_proxy}
4106 @deftypefun {int} {gnutls_x509_crt_set_proxy} (gnutls_x509_crt_t @var{crt}, int @var{pathLenConstraint}, const char * @var{policyLanguage}, const char * @var{policy}, size_t @var{sizeof_policy})
4107 @var{crt}: a certificate of type @code{gnutls_x509_crt_t} 
4108
4109 @var{pathLenConstraint}: non-negative error codes indicate maximum length of path,
4110 and negative error codes indicate that the pathLenConstraints field should
4111 not be present.
4112
4113 @var{policyLanguage}: OID describing the language of  @code{policy} .
4114
4115 @var{policy}: uint8_t byte array with policy language, can be @code{NULL} 
4116
4117 @var{sizeof_policy}: size of  @code{policy} .
4118
4119 This function will set the proxyCertInfo extension.
4120
4121 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
4122 negative error value.
4123 @end deftypefun
4124
4125 @subheading gnutls_x509_crt_set_proxy_dn
4126 @anchor{gnutls_x509_crt_set_proxy_dn}
4127 @deftypefun {int} {gnutls_x509_crt_set_proxy_dn} (gnutls_x509_crt_t @var{crt}, gnutls_x509_crt_t @var{eecrt}, unsigned int @var{raw_flag}, const void * @var{name}, unsigned int @var{sizeof_name})
4128 @var{crt}: a gnutls_x509_crt_t structure with the new proxy cert
4129
4130 @var{eecrt}: the end entity certificate that will be issuing the proxy
4131
4132 @var{raw_flag}: must be 0, or 1 if the CN is DER encoded
4133
4134 @var{name}: a pointer to the CN name, may be NULL (but MUST then be added later)
4135
4136 @var{sizeof_name}: holds the size of  @code{name} 
4137
4138 This function will set the subject in  @code{crt} to the end entity's
4139  @code{eecrt} subject name, and add a single Common Name component  @code{name} of size  @code{sizeof_name} .  This corresponds to the required proxy
4140 certificate naming style.  Note that if  @code{name} is @code{NULL} , you MUST
4141 set it later by using @code{gnutls_x509_crt_set_dn_by_oid()}  or similar.
4142
4143 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
4144 negative error value.
4145 @end deftypefun
4146
4147 @subheading gnutls_x509_crt_set_serial
4148 @anchor{gnutls_x509_crt_set_serial}
4149 @deftypefun {int} {gnutls_x509_crt_set_serial} (gnutls_x509_crt_t @var{cert}, const void * @var{serial}, size_t @var{serial_size})
4150 @var{cert}: a certificate of type @code{gnutls_x509_crt_t} 
4151
4152 @var{serial}: The serial number
4153
4154 @var{serial_size}: Holds the size of the serial field.
4155
4156 This function will set the X.509 certificate's serial number.
4157 While the serial number is an integer, it is often handled
4158 as an opaque field by several CAs. For this reason this function
4159 accepts any kind of data as a serial number. To be consistent
4160 with the X.509/PKIX specifications the provided  @code{serial} should be 
4161 a big-endian positive number (i.e. it's leftmost bit should be zero).
4162
4163 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
4164 negative error value.
4165 @end deftypefun
4166
4167 @subheading gnutls_x509_crt_set_subject_alt_name
4168 @anchor{gnutls_x509_crt_set_subject_alt_name}
4169 @deftypefun {int} {gnutls_x509_crt_set_subject_alt_name} (gnutls_x509_crt_t @var{crt}, gnutls_x509_subject_alt_name_t @var{type}, const void * @var{data}, unsigned int @var{data_size}, unsigned int @var{flags})
4170 @var{crt}: a certificate of type @code{gnutls_x509_crt_t} 
4171
4172 @var{type}: is one of the gnutls_x509_subject_alt_name_t enumerations
4173
4174 @var{data}: The data to be set
4175
4176 @var{data_size}: The size of data to be set
4177
4178 @var{flags}: GNUTLS_FSAN_SET to clear previous data or GNUTLS_FSAN_APPEND to append. 
4179
4180 This function will set the subject alternative name certificate
4181 extension. It can set the following types:
4182
4183 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
4184 negative error value.
4185
4186 @strong{Since:} 2.6.0
4187 @end deftypefun
4188
4189 @subheading gnutls_x509_crt_set_subject_alternative_name
4190 @anchor{gnutls_x509_crt_set_subject_alternative_name}
4191 @deftypefun {int} {gnutls_x509_crt_set_subject_alternative_name} (gnutls_x509_crt_t @var{crt}, gnutls_x509_subject_alt_name_t           @var{type}, const char * @var{data_string})
4192 @var{crt}: a certificate of type @code{gnutls_x509_crt_t} 
4193
4194 @var{type}: is one of the gnutls_x509_subject_alt_name_t enumerations
4195
4196 @var{data_string}: The data to be set, a (0) terminated string
4197
4198 This function will set the subject alternative name certificate
4199 extension. This function assumes that data can be expressed as a null
4200 terminated string.
4201
4202 The name of the function is unfortunate since it is incosistent with
4203 @code{gnutls_x509_crt_get_subject_alt_name()} .
4204
4205 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
4206 negative error value.
4207 @end deftypefun
4208
4209 @subheading gnutls_x509_crt_set_subject_key_id
4210 @anchor{gnutls_x509_crt_set_subject_key_id}
4211 @deftypefun {int} {gnutls_x509_crt_set_subject_key_id} (gnutls_x509_crt_t @var{cert}, const void * @var{id}, size_t @var{id_size})
4212 @var{cert}: a certificate of type @code{gnutls_x509_crt_t} 
4213
4214 @var{id}: The key ID
4215
4216 @var{id_size}: Holds the size of the subject key ID field.
4217
4218 This function will set the X.509 certificate's subject key ID
4219 extension.
4220
4221 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
4222 negative error value.
4223 @end deftypefun
4224
4225 @subheading gnutls_x509_crt_set_version
4226 @anchor{gnutls_x509_crt_set_version}
4227 @deftypefun {int} {gnutls_x509_crt_set_version} (gnutls_x509_crt_t @var{crt}, unsigned int @var{version})
4228 @var{crt}: a certificate of type @code{gnutls_x509_crt_t} 
4229
4230 @var{version}: holds the version number. For X.509v1 certificates must be 1.
4231
4232 This function will set the version of the certificate.  This must
4233 be one for X.509 version 1, and so on.  Plain certificates without
4234 extensions must have version set to one.
4235
4236 To create well-formed certificates, you must specify version 3 if
4237 you use any certificate extensions.  Extensions are created by
4238 functions such as @code{gnutls_x509_crt_set_subject_alt_name()} 
4239 or @code{gnutls_x509_crt_set_key_usage()} .
4240
4241 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
4242 negative error value.
4243 @end deftypefun
4244
4245 @subheading gnutls_x509_crt_sign
4246 @anchor{gnutls_x509_crt_sign}
4247 @deftypefun {int} {gnutls_x509_crt_sign} (gnutls_x509_crt_t @var{crt}, gnutls_x509_crt_t @var{issuer}, gnutls_x509_privkey_t @var{issuer_key})
4248 @var{crt}: a certificate of type @code{gnutls_x509_crt_t} 
4249
4250 @var{issuer}: is the certificate of the certificate issuer
4251
4252 @var{issuer_key}: holds the issuer's private key
4253
4254 This function is the same a @code{gnutls_x509_crt_sign2()}  with no flags,
4255 and SHA1 as the hash algorithm.
4256
4257 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
4258 negative error value.
4259 @end deftypefun
4260
4261 @subheading gnutls_x509_crt_sign2
4262 @anchor{gnutls_x509_crt_sign2}
4263 @deftypefun {int} {gnutls_x509_crt_sign2} (gnutls_x509_crt_t @var{crt}, gnutls_x509_crt_t @var{issuer}, gnutls_x509_privkey_t @var{issuer_key}, gnutls_digest_algorithm_t @var{dig}, unsigned int @var{flags})
4264 @var{crt}: a certificate of type @code{gnutls_x509_crt_t} 
4265
4266 @var{issuer}: is the certificate of the certificate issuer
4267
4268 @var{issuer_key}: holds the issuer's private key
4269
4270 @var{dig}: The message digest to use, @code{GNUTLS_DIG_SHA1}  is a safe choice
4271
4272 @var{flags}: must be 0
4273
4274 This function will sign the certificate with the issuer's private key, and
4275 will copy the issuer's information into the certificate.
4276
4277 This must be the last step in a certificate generation since all
4278 the previously set parameters are now signed.
4279
4280 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
4281 negative error value.
4282 @end deftypefun
4283
4284 @subheading gnutls_x509_crt_verify
4285 @anchor{gnutls_x509_crt_verify}
4286 @deftypefun {int} {gnutls_x509_crt_verify} (gnutls_x509_crt_t @var{cert}, const gnutls_x509_crt_t * @var{CA_list}, int @var{CA_list_length}, unsigned int @var{flags}, unsigned int * @var{verify})
4287 @var{cert}: is the certificate to be verified
4288
4289 @var{CA_list}: is one certificate that is considered to be trusted one
4290
4291 @var{CA_list_length}: holds the number of CA certificate in CA_list
4292
4293 @var{flags}: Flags that may be used to change the verification algorithm. Use OR of the gnutls_certificate_verify_flags enumerations.
4294
4295 @var{verify}: will hold the certificate verification output.
4296
4297 This function will try to verify the given certificate and return
4298 its status. Note that a verification error does not imply a negative
4299 return status. In that case the  @code{verify} status is set.
4300
4301 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
4302 negative error value.
4303 @end deftypefun
4304
4305 @subheading gnutls_x509_dn_deinit
4306 @anchor{gnutls_x509_dn_deinit}
4307 @deftypefun {void} {gnutls_x509_dn_deinit} (gnutls_x509_dn_t @var{dn})
4308 @var{dn}: a DN uint8_t object pointer.
4309
4310 This function deallocates the DN object as returned by
4311 @code{gnutls_x509_dn_import()} .
4312
4313 @strong{Since:} 2.4.0
4314 @end deftypefun
4315
4316 @subheading gnutls_x509_dn_export
4317 @anchor{gnutls_x509_dn_export}
4318 @deftypefun {int} {gnutls_x509_dn_export} (gnutls_x509_dn_t @var{dn}, gnutls_x509_crt_fmt_t @var{format}, void * @var{output_data}, size_t * @var{output_data_size})
4319 @var{dn}: Holds the uint8_t DN object
4320
4321 @var{format}: the format of output params. One of PEM or DER.
4322
4323 @var{output_data}: will contain a DN PEM or DER encoded
4324
4325 @var{output_data_size}: holds the size of output_data (and will be
4326 replaced by the actual size of parameters)
4327
4328 This function will export the DN to DER or PEM format.
4329
4330 If the buffer provided is not long enough to hold the output, then
4331 * @code{output_data_size} is updated and @code{GNUTLS_E_SHORT_MEMORY_BUFFER} 
4332 will be returned.
4333
4334 If the structure is PEM encoded, it will have a header
4335 of "BEGIN NAME".
4336
4337 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
4338 negative error value.
4339 @end deftypefun
4340
4341 @subheading gnutls_x509_dn_export2
4342 @anchor{gnutls_x509_dn_export2}
4343 @deftypefun {int} {gnutls_x509_dn_export2} (gnutls_x509_dn_t @var{dn}, gnutls_x509_crt_fmt_t @var{format}, gnutls_datum_t * @var{out})
4344 @var{dn}: Holds the uint8_t DN object
4345
4346 @var{format}: the format of output params. One of PEM or DER.
4347
4348 @var{out}: will contain a DN PEM or DER encoded
4349
4350 This function will export the DN to DER or PEM format.
4351
4352 The output buffer is allocated using @code{gnutls_malloc()} .
4353
4354 If the structure is PEM encoded, it will have a header
4355 of "BEGIN NAME".
4356
4357 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
4358 negative error value.
4359
4360 @strong{Since:} 3.1.3
4361 @end deftypefun
4362
4363 @subheading gnutls_x509_dn_get_rdn_ava
4364 @anchor{gnutls_x509_dn_get_rdn_ava}
4365 @deftypefun {int} {gnutls_x509_dn_get_rdn_ava} (gnutls_x509_dn_t @var{dn}, int @var{irdn}, int @var{iava}, gnutls_x509_ava_st * @var{ava})
4366 @var{dn}: a pointer to DN
4367
4368 @var{irdn}: index of RDN
4369
4370 @var{iava}: index of AVA.
4371
4372 @var{ava}: Pointer to structure which will hold output information.
4373
4374 Get pointers to data within the DN. The format of the  @code{ava} structure
4375 is shown below.
4376
4377 struct gnutls_x509_ava_st @{
4378 gnutls_datum_t oid;
4379 gnutls_datum_t value;
4380 unsigned long value_tag;
4381 @};
4382
4383 The X.509 distinguished name is a sequence of sequences of strings
4384 and this is what the  @code{irdn} and  @code{iava} indexes model.
4385
4386 Note that  @code{ava} will contain pointers into the  @code{dn} structure which
4387 in turns points to the original certificate. Thus you should not
4388 modify any data or deallocate any of those.
4389
4390 This is a low-level function that requires the caller to do the
4391 value conversions when necessary (e.g. from UCS-2).
4392
4393 @strong{Returns:} Returns 0 on success, or an error code.
4394 @end deftypefun
4395
4396 @subheading gnutls_x509_dn_import
4397 @anchor{gnutls_x509_dn_import}
4398 @deftypefun {int} {gnutls_x509_dn_import} (gnutls_x509_dn_t @var{dn}, const gnutls_datum_t * @var{data})
4399 @var{dn}: the structure that will hold the imported DN
4400
4401 @var{data}: should contain a DER encoded RDN sequence
4402
4403 This function parses an RDN sequence and stores the result to a
4404 @code{gnutls_x509_dn_t}  structure. The structure must have been initialized
4405 with @code{gnutls_x509_dn_init()} . You may use @code{gnutls_x509_dn_get_rdn_ava()}  to
4406 decode the DN.
4407
4408 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
4409 negative error value.
4410
4411 @strong{Since:} 2.4.0
4412 @end deftypefun
4413
4414 @subheading gnutls_x509_dn_init
4415 @anchor{gnutls_x509_dn_init}
4416 @deftypefun {int} {gnutls_x509_dn_init} (gnutls_x509_dn_t * @var{dn})
4417 @var{dn}: the object to be initialized
4418
4419 This function initializes a @code{gnutls_x509_dn_t}  structure.
4420
4421 The object returned must be deallocated using
4422 @code{gnutls_x509_dn_deinit()} .
4423
4424 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
4425 negative error value.
4426
4427 @strong{Since:} 2.4.0
4428 @end deftypefun
4429
4430 @subheading gnutls_x509_dn_oid_known
4431 @anchor{gnutls_x509_dn_oid_known}
4432 @deftypefun {int} {gnutls_x509_dn_oid_known} (const char * @var{oid})
4433 @var{oid}: holds an Object Identifier in a null terminated string
4434
4435 This function will inform about known DN OIDs. This is useful since
4436 functions like @code{gnutls_x509_crt_set_dn_by_oid()}  use the information
4437 on known OIDs to properly encode their input. Object Identifiers
4438 that are not known are not encoded by these functions, and their
4439 input is stored directly into the ASN.1 structure. In that case of
4440 unknown OIDs, you have the responsibility of DER encoding your
4441 data.
4442
4443 @strong{Returns:} 1 on known OIDs and 0 otherwise.
4444 @end deftypefun
4445
4446 @subheading gnutls_x509_dn_oid_name
4447 @anchor{gnutls_x509_dn_oid_name}
4448 @deftypefun {const char *} {gnutls_x509_dn_oid_name} (const char * @var{oid}, unsigned int @var{flags})
4449 @var{oid}: holds an Object Identifier in a null terminated string
4450
4451 @var{flags}: 0 or GNUTLS_X509_DN_OID_*
4452
4453 This function will return the name of a known DN OID. If
4454 @code{GNUTLS_X509_DN_OID_RETURN_OID}  is specified this function
4455 will return the given OID if no descriptive name has been
4456 found.
4457
4458 @strong{Returns:} A null terminated string or NULL otherwise.
4459
4460 @strong{Since:} 3.0
4461 @end deftypefun
4462
4463 @subheading gnutls_x509_ext_export_aia
4464 @anchor{gnutls_x509_ext_export_aia}
4465 @deftypefun {int} {gnutls_x509_ext_export_aia} (gnutls_x509_aia_t @var{aia}, gnutls_datum_t * @var{ext})
4466 @var{aia}: The authority info access structure
4467
4468 @var{ext}: The DER-encoded extension data; must be freed using @code{gnutls_free()} .
4469
4470 This function will DER encode the Authority Information Access (AIA)
4471 extension; see RFC 5280 section 4.2.2.1 for more information on the
4472 extension.  
4473
4474 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
4475 negative error value.
4476
4477 @strong{Since:} 3.3.0
4478 @end deftypefun
4479
4480 @subheading gnutls_x509_ext_export_authority_key_id
4481 @anchor{gnutls_x509_ext_export_authority_key_id}
4482 @deftypefun {int} {gnutls_x509_ext_export_authority_key_id} (gnutls_x509_aki_t @var{aki}, gnutls_datum_t * @var{ext})
4483 @var{aki}: An initialized authority key identifier structure
4484
4485 @var{ext}: The DER-encoded extension data; must be freed using @code{gnutls_free()} .
4486
4487 This function will convert the provided key identifier to a
4488 DER-encoded PKIX AuthorityKeyIdentifier extension. 
4489 The output data in  @code{ext} will be allocated using
4490 @code{gnutls_malloc()} .
4491
4492 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a negative error value.
4493
4494 @strong{Since:} 3.3.0
4495 @end deftypefun
4496
4497 @subheading gnutls_x509_ext_export_basic_constraints
4498 @anchor{gnutls_x509_ext_export_basic_constraints}
4499 @deftypefun {int} {gnutls_x509_ext_export_basic_constraints} (unsigned int @var{ca}, int @var{pathlen}, gnutls_datum_t * @var{ext})
4500 @var{ca}: non-zero for a CA
4501
4502 @var{pathlen}: The path length constraint (set to -1 for no constraint)
4503
4504 @var{ext}: The DER-encoded extension data; must be freed using @code{gnutls_free()} .
4505
4506 This function will convert the parameters provided to a basic constraints
4507 DER encoded extension (2.5.29.19).
4508 The  @code{ext} data will be allocated using
4509 @code{gnutls_malloc()} .
4510
4511 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
4512 negative error value.
4513
4514 @strong{Since:} 3.3.0
4515 @end deftypefun
4516
4517 @subheading gnutls_x509_ext_export_crl_dist_points
4518 @anchor{gnutls_x509_ext_export_crl_dist_points}
4519 @deftypefun {int} {gnutls_x509_ext_export_crl_dist_points} (gnutls_x509_crl_dist_points_t @var{cdp}, gnutls_datum_t * @var{ext})
4520 @var{cdp}: A pointer to an initialized CRL distribution points structure.
4521
4522 @var{ext}: The DER-encoded extension data; must be freed using @code{gnutls_free()} .
4523
4524 This function will convert the provided policies, to a certificate policy
4525 DER encoded extension (2.5.29.31).
4526
4527 The  @code{ext} data will be allocated using @code{gnutls_malloc()} .
4528
4529 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a negative error value.
4530
4531 @strong{Since:} 3.3.0
4532 @end deftypefun
4533
4534 @subheading gnutls_x509_ext_export_key_purposes
4535 @anchor{gnutls_x509_ext_export_key_purposes}
4536 @deftypefun {int} {gnutls_x509_ext_export_key_purposes} (gnutls_x509_key_purposes_t @var{p}, gnutls_datum_t * @var{ext})
4537 @var{p}: The key purposes structure
4538
4539 @var{ext}: The DER-encoded extension data; must be freed using @code{gnutls_free()} .
4540
4541 This function will convert the key purposes structure to a
4542 DER-encoded PKIX ExtKeyUsageSyntax (2.5.29.37) extension. The output data in 
4543  @code{ext} will be allocated usin @code{gnutls_malloc()} .
4544
4545 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a negative error value.
4546
4547 @strong{Since:} 3.3.0
4548 @end deftypefun
4549
4550 @subheading gnutls_x509_ext_export_key_usage
4551 @anchor{gnutls_x509_ext_export_key_usage}
4552 @deftypefun {int} {gnutls_x509_ext_export_key_usage} (unsigned int @var{usage}, gnutls_datum_t * @var{ext})
4553 @var{usage}: an ORed sequence of the GNUTLS_KEY_* elements.
4554
4555 @var{ext}: The DER-encoded extension data; must be freed using @code{gnutls_free()} .
4556
4557 This function will convert the keyUsage bit string to a DER
4558 encoded PKIX extension. The  @code{ext} data will be allocated using
4559 @code{gnutls_malloc()} .
4560
4561 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
4562 negative error value.
4563
4564 @strong{Since:} 3.3.0
4565 @end deftypefun
4566
4567 @subheading gnutls_x509_ext_export_name_constraints
4568 @anchor{gnutls_x509_ext_export_name_constraints}
4569 @deftypefun {int} {gnutls_x509_ext_export_name_constraints} (gnutls_x509_name_constraints_t @var{nc}, gnutls_datum_t * @var{ext})
4570 @var{nc}: The nameconstraints structure
4571
4572 @var{ext}: The DER-encoded extension data; must be freed using @code{gnutls_free()} .
4573
4574 This function will convert the provided name constraints structure to a
4575 DER-encoded PKIX NameConstraints (2.5.29.30) extension. The output data in 
4576  @code{ext} will be allocated usin @code{gnutls_malloc()} .
4577
4578 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a negative error value.
4579
4580 @strong{Since:} 3.3.0
4581 @end deftypefun
4582
4583 @subheading gnutls_x509_ext_export_policies
4584 @anchor{gnutls_x509_ext_export_policies}
4585 @deftypefun {int} {gnutls_x509_ext_export_policies} (gnutls_x509_policies_t @var{policies}, gnutls_datum_t * @var{ext})
4586 @var{policies}: A pointer to an initialized policies structure.
4587
4588 @var{ext}: The DER-encoded extension data; must be freed using @code{gnutls_free()} .
4589
4590 This function will convert the provided policies, to a certificate policy
4591 DER encoded extension (2.5.29.32).
4592
4593 The  @code{ext} data will be allocated using @code{gnutls_malloc()} .
4594
4595 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a negative error value.
4596
4597 @strong{Since:} 3.3.0
4598 @end deftypefun
4599
4600 @subheading gnutls_x509_ext_export_private_key_usage_period
4601 @anchor{gnutls_x509_ext_export_private_key_usage_period}
4602 @deftypefun {int} {gnutls_x509_ext_export_private_key_usage_period} (time_t @var{activation}, time_t @var{expiration}, gnutls_datum_t * @var{ext})
4603 @var{activation}: The activation time
4604
4605 @var{expiration}: The expiration time
4606
4607 @var{ext}: The DER-encoded extension data; must be freed using @code{gnutls_free()} .
4608
4609 This function will convert the periods provided to a private key
4610 usage DER encoded extension (2.5.29.16).
4611 The  @code{ext} data will be allocated using
4612 @code{gnutls_malloc()} .
4613
4614 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
4615 negative error value.
4616
4617 @strong{Since:} 3.3.0
4618 @end deftypefun
4619
4620 @subheading gnutls_x509_ext_export_proxy
4621 @anchor{gnutls_x509_ext_export_proxy}
4622 @deftypefun {int} {gnutls_x509_ext_export_proxy} (int @var{pathLenConstraint}, const char * @var{policyLanguage}, const char * @var{policy}, size_t @var{sizeof_policy}, gnutls_datum_t * @var{ext})
4623 @var{pathLenConstraint}: non-negative error codes indicate maximum length of path,
4624 and negative error codes indicate that the pathLenConstraints field should
4625 not be present.
4626
4627 @var{policyLanguage}: OID describing the language of  @code{policy} .
4628
4629 @var{policy}: uint8_t byte array with policy language, can be @code{NULL} 
4630
4631 @var{sizeof_policy}: size of  @code{policy} .
4632
4633 @var{ext}: The DER-encoded extension data; must be freed using @code{gnutls_free()} .
4634
4635 This function will convert the parameters provided to a proxyCertInfo extension.
4636
4637 The  @code{ext} data will be allocated using
4638 @code{gnutls_malloc()} .
4639
4640 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
4641 negative error value.
4642
4643 @strong{Since:} 3.3.0
4644 @end deftypefun
4645
4646 @subheading gnutls_x509_ext_export_subject_alt_names
4647 @anchor{gnutls_x509_ext_export_subject_alt_names}
4648 @deftypefun {int} {gnutls_x509_ext_export_subject_alt_names} (gnutls_subject_alt_names_t @var{sans}, gnutls_datum_t * @var{ext})
4649 @var{sans}: The alternative names structure
4650
4651 @var{ext}: The DER-encoded extension data; must be freed using @code{gnutls_free()} .
4652
4653 This function will convert the provided alternative names structure to a
4654 DER-encoded SubjectAltName PKIX extension. The output data in  @code{ext} will be allocated using
4655 @code{gnutls_malloc()} .
4656
4657 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a negative error value.
4658
4659 @strong{Since:} 3.3.0
4660 @end deftypefun
4661
4662 @subheading gnutls_x509_ext_export_subject_key_id
4663 @anchor{gnutls_x509_ext_export_subject_key_id}
4664 @deftypefun {int} {gnutls_x509_ext_export_subject_key_id} (const gnutls_datum_t * @var{id}, gnutls_datum_t * @var{ext})
4665 @var{id}: The key identifier
4666
4667 @var{ext}: The DER-encoded extension data; must be freed using @code{gnutls_free()} .
4668
4669 This function will convert the provided key identifier to a
4670 DER-encoded PKIX SubjectKeyIdentifier extension. 
4671 The output data in  @code{ext} will be allocated using
4672 @code{gnutls_malloc()} .
4673
4674 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a negative error value.
4675
4676 @strong{Since:} 3.3.0
4677 @end deftypefun
4678
4679 @subheading gnutls_x509_ext_import_aia
4680 @anchor{gnutls_x509_ext_import_aia}
4681 @deftypefun {int} {gnutls_x509_ext_import_aia} (const gnutls_datum_t * @var{ext}, gnutls_x509_aia_t @var{aia}, unsigned int @var{flags})
4682 @var{ext}: The DER-encoded extension data
4683
4684 @var{aia}: The authority info access structure
4685
4686 @var{flags}: should be zero
4687
4688 This function extracts the Authority Information Access (AIA)
4689 extension from the provided DER-encoded data; see RFC 5280 section 4.2.2.1 
4690 for more information on the extension.  The
4691 AIA extension holds a sequence of AccessDescription (AD) data.
4692
4693 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a negative error value.
4694
4695 @strong{Since:} 3.3.0
4696 @end deftypefun
4697
4698 @subheading gnutls_x509_ext_import_authority_key_id
4699 @anchor{gnutls_x509_ext_import_authority_key_id}
4700 @deftypefun {int} {gnutls_x509_ext_import_authority_key_id} (const gnutls_datum_t * @var{ext}, gnutls_x509_aki_t @var{aki}, unsigned int @var{flags})
4701 @var{ext}: a DER encoded extension
4702
4703 @var{aki}: An initialized authority key identifier structure
4704
4705 @var{flags}: should be zero
4706
4707 This function will return the subject key ID stored in the provided
4708 AuthorityKeyIdentifier extension.
4709
4710 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
4711 if the extension is not present, otherwise a negative error value.
4712
4713 @strong{Since:} 3.3.0
4714 @end deftypefun
4715
4716 @subheading gnutls_x509_ext_import_basic_constraints
4717 @anchor{gnutls_x509_ext_import_basic_constraints}
4718 @deftypefun {int} {gnutls_x509_ext_import_basic_constraints} (const gnutls_datum_t * @var{ext}, unsigned int * @var{ca}, int * @var{pathlen})
4719 @var{ext}: the DER encoded extension data
4720
4721 @var{ca}: will be non zero if the CA status is true
4722
4723 @var{pathlen}: the path length constraint; will be set to -1 for no limit
4724
4725 This function will return the CA status and path length constraint
4726 as written in the PKIX extension 2.5.29.19.
4727
4728 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
4729 negative error value.
4730
4731 @strong{Since:} 3.3.0
4732 @end deftypefun
4733
4734 @subheading gnutls_x509_ext_import_crl_dist_points
4735 @anchor{gnutls_x509_ext_import_crl_dist_points}
4736 @deftypefun {int} {gnutls_x509_ext_import_crl_dist_points} (const gnutls_datum_t * @var{ext}, gnutls_x509_crl_dist_points_t @var{cdp}, unsigned int @var{flags})
4737 @var{ext}: the DER encoded extension data
4738
4739 @var{cdp}: A pointer to an initialized CRL distribution points structure.
4740
4741 @var{flags}: should be zero
4742
4743 This function will extract the CRL distribution points extension (2.5.29.31) 
4744 and store it into the provided structure.
4745
4746 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a negative error value.
4747
4748 @strong{Since:} 3.3.0
4749 @end deftypefun
4750
4751 @subheading gnutls_x509_ext_import_key_purposes
4752 @anchor{gnutls_x509_ext_import_key_purposes}
4753 @deftypefun {int} {gnutls_x509_ext_import_key_purposes} (const gnutls_datum_t * @var{ext}, gnutls_x509_key_purposes_t @var{p}, unsigned int @var{flags})
4754 @var{ext}: The DER-encoded extension data
4755
4756 @var{p}: The key purposes structure
4757
4758 @var{flags}: should be zero
4759
4760 This function will extract the key purposes in the provided DER-encoded
4761 ExtKeyUsageSyntax PKIX extension, to a @code{gnutls_x509_key_purposes_t}  structure. 
4762 The structure must be initialized.
4763
4764 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a negative error value.
4765
4766 @strong{Since:} 3.3.0
4767 @end deftypefun
4768
4769 @subheading gnutls_x509_ext_import_key_usage
4770 @anchor{gnutls_x509_ext_import_key_usage}
4771 @deftypefun {int} {gnutls_x509_ext_import_key_usage} (const gnutls_datum_t * @var{ext}, unsigned int * @var{key_usage})
4772 @var{ext}: the DER encoded extension data
4773
4774 @var{key_usage}: where the key usage bits will be stored
4775
4776 This function will return certificate's key usage, by reading the DER
4777 data of the keyUsage X.509 extension (2.5.29.15). The key usage value will ORed
4778 values of the: @code{GNUTLS_KEY_DIGITAL_SIGNATURE} ,
4779 @code{GNUTLS_KEY_NON_REPUDIATION} , @code{GNUTLS_KEY_KEY_ENCIPHERMENT} ,
4780 @code{GNUTLS_KEY_DATA_ENCIPHERMENT} , @code{GNUTLS_KEY_KEY_AGREEMENT} ,
4781 @code{GNUTLS_KEY_KEY_CERT_SIGN} , @code{GNUTLS_KEY_CRL_SIGN} ,
4782 @code{GNUTLS_KEY_ENCIPHER_ONLY} , @code{GNUTLS_KEY_DECIPHER_ONLY} .
4783
4784 @strong{Returns:} the certificate key usage, or a negative error code in case of
4785 parsing error.  If the certificate does not contain the keyUsage
4786 extension @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  will be
4787 returned.
4788
4789 @strong{Since:} 3.3.0
4790 @end deftypefun
4791
4792 @subheading gnutls_x509_ext_import_name_constraints
4793 @anchor{gnutls_x509_ext_import_name_constraints}
4794 @deftypefun {int} {gnutls_x509_ext_import_name_constraints} (const gnutls_datum_t * @var{ext}, gnutls_x509_name_constraints_t @var{nc}, unsigned int @var{flags})
4795 @var{ext}: a DER encoded extension
4796
4797 @var{nc}: The nameconstraints intermediate structure
4798
4799 @var{flags}: zero or @code{GNUTLS_NAME_CONSTRAINTS_FLAG_APPEND} 
4800
4801 This function will return an intermediate structure containing
4802 the name constraints of the provided NameConstraints extension. That
4803 structure can be used in combination with @code{gnutls_x509_name_constraints_check()} 
4804 to verify whether a server's name is in accordance with the constraints.
4805
4806 When the  @code{flags} is set to @code{GNUTLS_NAME_CONSTRAINTS_FLAG_APPEND} , then if 
4807 the  @code{nc} structure is empty
4808 this function will behave identically as if the flag was not set.
4809 Otherwise if there are elements in the  @code{nc} structure then only the
4810 excluded constraints will be appended to the constraints.
4811
4812 Note that  @code{nc} must be initialized prior to calling this function.
4813
4814 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
4815 if the extension is not present, otherwise a negative error value.
4816
4817 @strong{Since:} 3.3.0
4818 @end deftypefun
4819
4820 @subheading gnutls_x509_ext_import_policies
4821 @anchor{gnutls_x509_ext_import_policies}
4822 @deftypefun {int} {gnutls_x509_ext_import_policies} (const gnutls_datum_t * @var{ext}, gnutls_x509_policies_t @var{policies}, unsigned int @var{flags})
4823 @var{ext}: the DER encoded extension data
4824
4825 @var{policies}: A pointer to an initialized policies structures.
4826
4827 @var{flags}: should be zero
4828
4829 This function will extract the certificate policy extension (2.5.29.32) 
4830 and store it the provided structure.
4831
4832 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a negative error value.
4833
4834 @strong{Since:} 3.3.0
4835 @end deftypefun
4836
4837 @subheading gnutls_x509_ext_import_private_key_usage_period
4838 @anchor{gnutls_x509_ext_import_private_key_usage_period}
4839 @deftypefun {int} {gnutls_x509_ext_import_private_key_usage_period} (const gnutls_datum_t * @var{ext}, time_t * @var{activation}, time_t * @var{expiration})
4840 @var{ext}: the DER encoded extension data
4841
4842 @var{activation}: Will hold the activation time
4843
4844 @var{expiration}: Will hold the expiration time
4845
4846 This function will return the expiration and activation
4847 times of the private key as written in the
4848 PKIX extension 2.5.29.16.
4849
4850 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
4851 negative error value.
4852
4853 @strong{Since:} 3.3.0
4854 @end deftypefun
4855
4856 @subheading gnutls_x509_ext_import_proxy
4857 @anchor{gnutls_x509_ext_import_proxy}
4858 @deftypefun {int} {gnutls_x509_ext_import_proxy} (const gnutls_datum_t * @var{ext}, int * @var{pathlen}, char ** @var{policyLanguage}, char ** @var{policy}, size_t * @var{sizeof_policy})
4859 @var{ext}: the DER encoded extension data
4860
4861 @var{pathlen}: pointer to output integer indicating path length (may be
4862 NULL), non-negative error codes indicate a present pCPathLenConstraint
4863 field and the actual value, -1 indicate that the field is absent.
4864
4865 @var{policyLanguage}: output variable with OID of policy language
4866
4867 @var{policy}: output variable with policy data
4868
4869 @var{sizeof_policy}: output variable size of policy data
4870
4871 This function will return the information from a proxy certificate
4872 extension. It reads the ProxyCertInfo X.509 extension (1.3.6.1.5.5.7.1.14).
4873
4874 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
4875 negative error value.
4876
4877 @strong{Since:} 3.3.0
4878 @end deftypefun
4879
4880 @subheading gnutls_x509_ext_import_subject_alt_names
4881 @anchor{gnutls_x509_ext_import_subject_alt_names}
4882 @deftypefun {int} {gnutls_x509_ext_import_subject_alt_names} (const gnutls_datum_t * @var{ext}, gnutls_subject_alt_names_t @var{sans}, unsigned int @var{flags})
4883 @var{ext}: The DER-encoded extension data
4884
4885 @var{sans}: The alternative names structure
4886
4887 @var{flags}: should be zero
4888
4889 This function will export the alternative names in the provided DER-encoded
4890 SubjectAltName PKIX extension, to a @code{gnutls_subject_alt_names_t}  structure. The structure
4891 must have been initialized.
4892
4893 This function will succeed even if there no subject alternative names
4894 in the structure.
4895
4896 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a negative error value.
4897
4898 @strong{Since:} 3.3.0
4899 @end deftypefun
4900
4901 @subheading gnutls_x509_ext_import_subject_key_id
4902 @anchor{gnutls_x509_ext_import_subject_key_id}
4903 @deftypefun {int} {gnutls_x509_ext_import_subject_key_id} (const gnutls_datum_t * @var{ext}, gnutls_datum_t * @var{id})
4904 @var{ext}: a DER encoded extension
4905
4906 @var{id}: will contain the subject key ID
4907
4908 This function will return the subject key ID stored in the provided
4909 SubjectKeyIdentifier extension. The ID will be allocated using
4910 @code{gnutls_malloc()} .
4911
4912 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
4913 if the extension is not present, otherwise a negative error value.
4914
4915 @strong{Since:} 3.3.0
4916 @end deftypefun
4917
4918 @subheading gnutls_x509_key_purpose_deinit
4919 @anchor{gnutls_x509_key_purpose_deinit}
4920 @deftypefun {void} {gnutls_x509_key_purpose_deinit} (gnutls_x509_key_purposes_t @var{p})
4921 @var{p}: The key purposes structure
4922
4923 This function will deinitialize an alternative names structure.
4924
4925 @strong{Since:} 3.3.0
4926 @end deftypefun
4927
4928 @subheading gnutls_x509_key_purpose_get
4929 @anchor{gnutls_x509_key_purpose_get}
4930 @deftypefun {int} {gnutls_x509_key_purpose_get} (gnutls_x509_key_purposes_t @var{p}, unsigned @var{idx}, gnutls_datum_t * @var{oid})
4931 @var{p}: The key purposes structure
4932
4933 @var{idx}: The index of the key purpose to retrieve
4934
4935 @var{oid}: Will hold the object identifier of the key purpose (to be treated as constant)
4936
4937 This function will retrieve the specified by the index key purpose in the
4938 purposes structure.
4939
4940 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
4941 if the index is out of bounds, otherwise a negative error value.
4942
4943 @strong{Since:} 3.3.0
4944 @end deftypefun
4945
4946 @subheading gnutls_x509_key_purpose_init
4947 @anchor{gnutls_x509_key_purpose_init}
4948 @deftypefun {int} {gnutls_x509_key_purpose_init} (gnutls_x509_key_purposes_t * @var{p})
4949 @var{p}: The key purposes structure
4950
4951 This function will initialize an alternative names structure.
4952
4953 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a negative error value.
4954
4955 @strong{Since:} 3.3.0
4956 @end deftypefun
4957
4958 @subheading gnutls_x509_key_purpose_set
4959 @anchor{gnutls_x509_key_purpose_set}
4960 @deftypefun {int} {gnutls_x509_key_purpose_set} (gnutls_x509_key_purposes_t @var{p}, const char * @var{oid})
4961 @var{p}: The key purposes structure
4962
4963 @var{oid}: The object identifier of the key purpose
4964
4965 This function will store the specified key purpose in the
4966 purposes structure.
4967
4968 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0), otherwise a negative error value.
4969
4970 @strong{Since:} 3.3.0
4971 @end deftypefun
4972
4973 @subheading gnutls_x509_name_constraints_add_excluded
4974 @anchor{gnutls_x509_name_constraints_add_excluded}
4975 @deftypefun {int} {gnutls_x509_name_constraints_add_excluded} (gnutls_x509_name_constraints_t @var{nc}, gnutls_x509_subject_alt_name_t @var{type}, const gnutls_datum_t * @var{name})
4976 @var{nc}: The nameconstraints structure
4977
4978 @var{type}: The type of the constraints
4979
4980 @var{name}: The data of the constraints
4981
4982 This function will add a name constraint to the list of excluded
4983 constraints.
4984
4985 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a negative error value.
4986
4987 @strong{Since:} 3.3.0
4988 @end deftypefun
4989
4990 @subheading gnutls_x509_name_constraints_add_permitted
4991 @anchor{gnutls_x509_name_constraints_add_permitted}
4992 @deftypefun {int} {gnutls_x509_name_constraints_add_permitted} (gnutls_x509_name_constraints_t @var{nc}, gnutls_x509_subject_alt_name_t @var{type}, const gnutls_datum_t * @var{name})
4993 @var{nc}: The nameconstraints structure
4994
4995 @var{type}: The type of the constraints
4996
4997 @var{name}: The data of the constraints
4998
4999 This function will add a name constraint to the list of permitted
5000 constraints.
5001
5002 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a negative error value.
5003
5004 @strong{Since:} 3.3.0
5005 @end deftypefun
5006
5007 @subheading gnutls_x509_name_constraints_check
5008 @anchor{gnutls_x509_name_constraints_check}
5009 @deftypefun {unsigned} {gnutls_x509_name_constraints_check} (gnutls_x509_name_constraints_t @var{nc}, gnutls_x509_subject_alt_name_t @var{type}, const gnutls_datum_t * @var{name})
5010 @var{nc}: the extracted name constraints structure
5011
5012 @var{type}: the type of the constraint to check (of type gnutls_x509_subject_alt_name_t)
5013
5014 @var{name}: the name to be checked
5015
5016 This function will check the provided name against the constraints in
5017  @code{nc} using the RFC5280 rules. Currently this function is limited to DNS
5018 names and emails (of type @code{GNUTLS_SAN_DNSNAME}  and @code{GNUTLS_SAN_RFC822NAME} ).
5019
5020 @strong{Returns:} zero if the provided name is not acceptable, and non-zero otherwise.
5021
5022 @strong{Since:} 3.3.0
5023 @end deftypefun
5024
5025 @subheading gnutls_x509_name_constraints_check_crt
5026 @anchor{gnutls_x509_name_constraints_check_crt}
5027 @deftypefun {unsigned} {gnutls_x509_name_constraints_check_crt} (gnutls_x509_name_constraints_t @var{nc}, gnutls_x509_subject_alt_name_t @var{type}, gnutls_x509_crt_t @var{cert})
5028 @var{nc}: the extracted name constraints structure
5029
5030 @var{type}: the type of the constraint to check (of type gnutls_x509_subject_alt_name_t)
5031
5032 @var{cert}: the certificate to be checked
5033
5034 This function will check the provided certificate names against the constraints in
5035  @code{nc} using the RFC5280 rules. It will traverse all the certificate's names and
5036 alternative names.
5037
5038 Currently this function is limited to DNS
5039 names and emails (of type @code{GNUTLS_SAN_DNSNAME}  and @code{GNUTLS_SAN_RFC822NAME} ).
5040
5041 @strong{Returns:} zero if the provided name is not acceptable, and non-zero otherwise.
5042
5043 @strong{Since:} 3.3.0
5044 @end deftypefun
5045
5046 @subheading gnutls_x509_name_constraints_deinit
5047 @anchor{gnutls_x509_name_constraints_deinit}
5048 @deftypefun {void} {gnutls_x509_name_constraints_deinit} (gnutls_x509_name_constraints_t @var{nc})
5049 @var{nc}: The nameconstraints structure
5050
5051 This function will deinitialize a name constraints structure.
5052
5053 @strong{Since:} 3.3.0
5054 @end deftypefun
5055
5056 @subheading gnutls_x509_name_constraints_get_excluded
5057 @anchor{gnutls_x509_name_constraints_get_excluded}
5058 @deftypefun {int} {gnutls_x509_name_constraints_get_excluded} (gnutls_x509_name_constraints_t @var{nc}, unsigned @var{idx}, unsigned * @var{type}, gnutls_datum_t * @var{name})
5059 @var{nc}: the extracted name constraints structure
5060
5061 @var{idx}: the index of the constraint
5062
5063 @var{type}: the type of the constraint (of type gnutls_x509_subject_alt_name_t)
5064
5065 @var{name}: the name in the constraint (of the specific type)
5066
5067 This function will return an intermediate structure containing
5068 the name constraints of the provided CA certificate. That
5069 structure can be used in combination with @code{gnutls_x509_name_constraints_check()} 
5070 to verify whether a server's name is in accordance with the constraints.
5071
5072 The name should be treated as constant and valid for the lifetime of  @code{nc} .
5073
5074 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
5075 if the extension is not present, otherwise a negative error value.
5076
5077 @strong{Since:} 3.3.0
5078 @end deftypefun
5079
5080 @subheading gnutls_x509_name_constraints_get_permitted
5081 @anchor{gnutls_x509_name_constraints_get_permitted}
5082 @deftypefun {int} {gnutls_x509_name_constraints_get_permitted} (gnutls_x509_name_constraints_t @var{nc}, unsigned @var{idx}, unsigned * @var{type}, gnutls_datum_t * @var{name})
5083 @var{nc}: the extracted name constraints structure
5084
5085 @var{idx}: the index of the constraint
5086
5087 @var{type}: the type of the constraint (of type gnutls_x509_subject_alt_name_t)
5088
5089 @var{name}: the name in the constraint (of the specific type)
5090
5091 This function will return an intermediate structure containing
5092 the name constraints of the provided CA certificate. That
5093 structure can be used in combination with @code{gnutls_x509_name_constraints_check()} 
5094 to verify whether a server's name is in accordance with the constraints.
5095
5096 The name should be treated as constant and valid for the lifetime of  @code{nc} .
5097
5098 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
5099 if the extension is not present, otherwise a negative error value.
5100
5101 @strong{Since:} 3.3.0
5102 @end deftypefun
5103
5104 @subheading gnutls_x509_name_constraints_init
5105 @anchor{gnutls_x509_name_constraints_init}
5106 @deftypefun {int} {gnutls_x509_name_constraints_init} (gnutls_x509_name_constraints_t * @var{nc})
5107 @var{nc}: The nameconstraints structure
5108
5109 This function will initialize a name constraints structure.
5110
5111 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a negative error value.
5112
5113 @strong{Since:} 3.3.0
5114 @end deftypefun
5115
5116 @subheading gnutls_x509_policies_deinit
5117 @anchor{gnutls_x509_policies_deinit}
5118 @deftypefun {void} {gnutls_x509_policies_deinit} (gnutls_x509_policies_t @var{policies})
5119 @var{policies}: The authority key identifier structure
5120
5121 This function will deinitialize an authority key identifier structure.
5122
5123 @strong{Since:} 3.3.0
5124 @end deftypefun
5125
5126 @subheading gnutls_x509_policies_get
5127 @anchor{gnutls_x509_policies_get}
5128 @deftypefun {int} {gnutls_x509_policies_get} (gnutls_x509_policies_t @var{policies}, unsigned int @var{seq}, struct gnutls_x509_policy_st * @var{policy})
5129 @var{policies}: The policies structure
5130
5131 @var{seq}: The index of the name to get
5132
5133 @var{policy}: Will hold the policy
5134
5135 This function will return a specific policy as stored in
5136 the  @code{policies} structure. The returned values should be treated as constant
5137 and valid for the lifetime of  @code{policies} .
5138
5139 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} 
5140 if the index is out of bounds, otherwise a negative error value.
5141
5142 @strong{Since:} 3.3.0
5143 @end deftypefun
5144
5145 @subheading gnutls_x509_policies_init
5146 @anchor{gnutls_x509_policies_init}
5147 @deftypefun {int} {gnutls_x509_policies_init} (gnutls_x509_policies_t * @var{policies})
5148 @var{policies}: The authority key ID structure
5149
5150 This function will initialize an authority key ID structure.
5151
5152 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a negative error value.
5153
5154 @strong{Since:} 3.3.0
5155 @end deftypefun
5156
5157 @subheading gnutls_x509_policies_set
5158 @anchor{gnutls_x509_policies_set}
5159 @deftypefun {int} {gnutls_x509_policies_set} (gnutls_x509_policies_t @var{policies}, const struct gnutls_x509_policy_st * @var{policy})
5160 @var{policies}: An initialized policies structure
5161
5162 @var{policy}: Contains the policy to set
5163
5164 This function will store the specified policy in
5165 the provided  @code{policies} structure.
5166
5167 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0), otherwise a negative error value.
5168
5169 @strong{Since:} 3.3.0
5170 @end deftypefun
5171
5172 @subheading gnutls_x509_policy_release
5173 @anchor{gnutls_x509_policy_release}
5174 @deftypefun {void} {gnutls_x509_policy_release} (struct gnutls_x509_policy_st * @var{policy})
5175 @var{policy}: a certificate policy
5176
5177 This function will deinitialize all memory associated with the provided
5178  @code{policy} . The policy is allocated using @code{gnutls_x509_crt_get_policy()} .
5179
5180 @strong{Since:} 3.1.5
5181 @end deftypefun
5182
5183 @subheading gnutls_x509_privkey_cpy
5184 @anchor{gnutls_x509_privkey_cpy}
5185 @deftypefun {int} {gnutls_x509_privkey_cpy} (gnutls_x509_privkey_t @var{dst}, gnutls_x509_privkey_t @var{src})
5186 @var{dst}: The destination key, which should be initialized.
5187
5188 @var{src}: The source key
5189
5190 This function will copy a private key from source to destination
5191 key. Destination has to be initialized.
5192
5193 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
5194 negative error value.
5195 @end deftypefun
5196
5197 @subheading gnutls_x509_privkey_deinit
5198 @anchor{gnutls_x509_privkey_deinit}
5199 @deftypefun {void} {gnutls_x509_privkey_deinit} (gnutls_x509_privkey_t @var{key})
5200 @var{key}: The structure to be deinitialized
5201
5202 This function will deinitialize a private key structure.
5203 @end deftypefun
5204
5205 @subheading gnutls_x509_privkey_export
5206 @anchor{gnutls_x509_privkey_export}
5207 @deftypefun {int} {gnutls_x509_privkey_export} (gnutls_x509_privkey_t @var{key}, gnutls_x509_crt_fmt_t @var{format}, void * @var{output_data}, size_t * @var{output_data_size})
5208 @var{key}: Holds the key
5209
5210 @var{format}: the format of output params. One of PEM or DER.
5211
5212 @var{output_data}: will contain a private key PEM or DER encoded
5213
5214 @var{output_data_size}: holds the size of output_data (and will be
5215 replaced by the actual size of parameters)
5216
5217 This function will export the private key to a PKCS1 structure for
5218 RSA keys, or an integer sequence for DSA keys.  The DSA keys are in
5219 the same format with the parameters used by openssl.
5220
5221 If the buffer provided is not long enough to hold the output, then
5222 * @code{output_data_size} is updated and @code{GNUTLS_E_SHORT_MEMORY_BUFFER} 
5223 will be returned.
5224
5225 If the structure is PEM encoded, it will have a header
5226 of "BEGIN RSA PRIVATE KEY".
5227
5228 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
5229 negative error value.
5230 @end deftypefun
5231
5232 @subheading gnutls_x509_privkey_export2
5233 @anchor{gnutls_x509_privkey_export2}
5234 @deftypefun {int} {gnutls_x509_privkey_export2} (gnutls_x509_privkey_t @var{key}, gnutls_x509_crt_fmt_t @var{format}, gnutls_datum_t * @var{out})
5235 @var{key}: Holds the key
5236
5237 @var{format}: the format of output params. One of PEM or DER.
5238
5239 @var{out}: will contain a private key PEM or DER encoded
5240
5241 This function will export the private key to a PKCS1 structure for
5242 RSA keys, or an integer sequence for DSA keys.  The DSA keys are in
5243 the same format with the parameters used by openssl.
5244
5245 The output buffer is allocated using @code{gnutls_malloc()} .
5246
5247 If the structure is PEM encoded, it will have a header
5248 of "BEGIN RSA PRIVATE KEY".
5249
5250 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
5251 negative error value.
5252
5253 Since 3.1.3
5254 @end deftypefun
5255
5256 @subheading gnutls_x509_privkey_export2_pkcs8
5257 @anchor{gnutls_x509_privkey_export2_pkcs8}
5258 @deftypefun {int} {gnutls_x509_privkey_export2_pkcs8} (gnutls_x509_privkey_t @var{key}, gnutls_x509_crt_fmt_t @var{format}, const char * @var{password}, unsigned int @var{flags}, gnutls_datum_t * @var{out})
5259 @var{key}: Holds the key
5260
5261 @var{format}: the format of output params. One of PEM or DER.
5262
5263 @var{password}: the password that will be used to encrypt the key.
5264
5265 @var{flags}: an ORed sequence of gnutls_pkcs_encrypt_flags_t
5266
5267 @var{out}: will contain a private key PEM or DER encoded
5268
5269 This function will export the private key to a PKCS8 structure.
5270 Both RSA and DSA keys can be exported. For DSA keys we use
5271 PKCS @code{11}  definitions. If the flags do not specify the encryption
5272 cipher, then the default 3DES (PBES2) will be used.
5273
5274 The  @code{password} can be either ASCII or UTF-8 in the default PBES2
5275 encryption schemas, or ASCII for the PKCS12 schemas.
5276
5277 The output buffer is allocated using @code{gnutls_malloc()} .
5278
5279 If the structure is PEM encoded, it will have a header
5280 of "BEGIN ENCRYPTED PRIVATE KEY" or "BEGIN PRIVATE KEY" if
5281 encryption is not used.
5282
5283 @strong{Returns:} In case of failure a negative error code will be
5284 returned, and 0 on success.
5285
5286 Since 3.1.3
5287 @end deftypefun
5288
5289 @subheading gnutls_x509_privkey_export_dsa_raw
5290 @anchor{gnutls_x509_privkey_export_dsa_raw}
5291 @deftypefun {int} {gnutls_x509_privkey_export_dsa_raw} (gnutls_x509_privkey_t @var{key}, gnutls_datum_t * @var{p}, gnutls_datum_t * @var{q}, gnutls_datum_t * @var{g}, gnutls_datum_t * @var{y}, gnutls_datum_t * @var{x})
5292 @var{key}: a structure that holds the DSA parameters
5293
5294 @var{p}: will hold the p
5295
5296 @var{q}: will hold the q
5297
5298 @var{g}: will hold the g
5299
5300 @var{y}: will hold the y
5301
5302 @var{x}: will hold the x
5303
5304 This function will export the DSA private key's parameters found
5305 in the given structure. The new parameters will be allocated using
5306 @code{gnutls_malloc()}  and will be stored in the appropriate datum.
5307
5308 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
5309 negative error value.
5310 @end deftypefun
5311
5312 @subheading gnutls_x509_privkey_export_ecc_raw
5313 @anchor{gnutls_x509_privkey_export_ecc_raw}
5314 @deftypefun {int} {gnutls_x509_privkey_export_ecc_raw} (gnutls_x509_privkey_t @var{key}, gnutls_ecc_curve_t * @var{curve}, gnutls_datum_t * @var{x}, gnutls_datum_t * @var{y}, gnutls_datum_t * @var{k})
5315 @var{key}: a structure that holds the rsa parameters
5316
5317 @var{curve}: will hold the curve
5318
5319 @var{x}: will hold the x coordinate
5320
5321 @var{y}: will hold the y coordinate
5322
5323 @var{k}: will hold the private key
5324
5325 This function will export the ECC private key's parameters found
5326 in the given structure. The new parameters will be allocated using
5327 @code{gnutls_malloc()}  and will be stored in the appropriate datum.
5328
5329 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
5330 negative error value.
5331
5332 @strong{Since:} 3.0
5333 @end deftypefun
5334
5335 @subheading gnutls_x509_privkey_export_pkcs8
5336 @anchor{gnutls_x509_privkey_export_pkcs8}
5337 @deftypefun {int} {gnutls_x509_privkey_export_pkcs8} (gnutls_x509_privkey_t @var{key}, gnutls_x509_crt_fmt_t @var{format}, const char * @var{password}, unsigned int @var{flags}, void * @var{output_data}, size_t * @var{output_data_size})
5338 @var{key}: Holds the key
5339
5340 @var{format}: the format of output params. One of PEM or DER.
5341
5342 @var{password}: the password that will be used to encrypt the key.
5343
5344 @var{flags}: an ORed sequence of gnutls_pkcs_encrypt_flags_t
5345
5346 @var{output_data}: will contain a private key PEM or DER encoded
5347
5348 @var{output_data_size}: holds the size of output_data (and will be
5349 replaced by the actual size of parameters)
5350
5351 This function will export the private key to a PKCS8 structure.
5352 Both RSA and DSA keys can be exported. For DSA keys we use
5353 PKCS @code{11}  definitions. If the flags do not specify the encryption
5354 cipher, then the default 3DES (PBES2) will be used.
5355
5356 The  @code{password} can be either ASCII or UTF-8 in the default PBES2
5357 encryption schemas, or ASCII for the PKCS12 schemas.
5358
5359 If the buffer provided is not long enough to hold the output, then
5360 *output_data_size is updated and GNUTLS_E_SHORT_MEMORY_BUFFER will
5361 be returned.
5362
5363 If the structure is PEM encoded, it will have a header
5364 of "BEGIN ENCRYPTED PRIVATE KEY" or "BEGIN PRIVATE KEY" if
5365 encryption is not used.
5366
5367 @strong{Returns:} In case of failure a negative error code will be
5368 returned, and 0 on success.
5369 @end deftypefun
5370
5371 @subheading gnutls_x509_privkey_export_rsa_raw
5372 @anchor{gnutls_x509_privkey_export_rsa_raw}
5373 @deftypefun {int} {gnutls_x509_privkey_export_rsa_raw} (gnutls_x509_privkey_t @var{key}, gnutls_datum_t * @var{m}, gnutls_datum_t * @var{e}, gnutls_datum_t * @var{d}, gnutls_datum_t * @var{p}, gnutls_datum_t * @var{q}, gnutls_datum_t * @var{u})
5374 @var{key}: a structure that holds the rsa parameters
5375
5376 @var{m}: will hold the modulus
5377
5378 @var{e}: will hold the public exponent
5379
5380 @var{d}: will hold the private exponent
5381
5382 @var{p}: will hold the first prime (p)
5383
5384 @var{q}: will hold the second prime (q)
5385
5386 @var{u}: will hold the coefficient
5387
5388 This function will export the RSA private key's parameters found
5389 in the given structure. The new parameters will be allocated using
5390 @code{gnutls_malloc()}  and will be stored in the appropriate datum.
5391
5392 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
5393 negative error value.
5394 @end deftypefun
5395
5396 @subheading gnutls_x509_privkey_export_rsa_raw2
5397 @anchor{gnutls_x509_privkey_export_rsa_raw2}
5398 @deftypefun {int} {gnutls_x509_privkey_export_rsa_raw2} (gnutls_x509_privkey_t @var{key}, gnutls_datum_t * @var{m}, gnutls_datum_t * @var{e}, gnutls_datum_t * @var{d}, gnutls_datum_t * @var{p}, gnutls_datum_t * @var{q}, gnutls_datum_t * @var{u}, gnutls_datum_t * @var{e1}, gnutls_datum_t * @var{e2})
5399 @var{key}: a structure that holds the rsa parameters
5400
5401 @var{m}: will hold the modulus
5402
5403 @var{e}: will hold the public exponent
5404
5405 @var{d}: will hold the private exponent
5406
5407 @var{p}: will hold the first prime (p)
5408
5409 @var{q}: will hold the second prime (q)
5410
5411 @var{u}: will hold the coefficient
5412
5413 @var{e1}: will hold e1 = d mod (p-1)
5414
5415 @var{e2}: will hold e2 = d mod (q-1)
5416
5417 This function will export the RSA private key's parameters found
5418 in the given structure. The new parameters will be allocated using
5419 @code{gnutls_malloc()}  and will be stored in the appropriate datum.
5420
5421 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
5422 negative error value.
5423
5424 @strong{Since:} 2.12.0
5425 @end deftypefun
5426
5427 @subheading gnutls_x509_privkey_fix
5428 @anchor{gnutls_x509_privkey_fix}
5429 @deftypefun {int} {gnutls_x509_privkey_fix} (gnutls_x509_privkey_t @var{key})
5430 @var{key}: Holds the key
5431
5432 This function will recalculate the secondary parameters in a key.
5433 In RSA keys, this can be the coefficient and exponent1,2.
5434
5435 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
5436 negative error value.
5437 @end deftypefun
5438
5439 @subheading gnutls_x509_privkey_generate
5440 @anchor{gnutls_x509_privkey_generate}
5441 @deftypefun {int} {gnutls_x509_privkey_generate} (gnutls_x509_privkey_t @var{key}, gnutls_pk_algorithm_t @var{algo}, unsigned int @var{bits}, unsigned int @var{flags})
5442 @var{key}: should contain a @code{gnutls_x509_privkey_t}  structure
5443
5444 @var{algo}: is one of the algorithms in @code{gnutls_pk_algorithm_t} .
5445
5446 @var{bits}: the size of the modulus
5447
5448 @var{flags}: unused for now.  Must be 0.
5449
5450 This function will generate a random private key. Note that this
5451 function must be called on an empty private key.
5452
5453 Note that when generating an elliptic curve key, the curve
5454 can be substituted in the place of the bits parameter using the
5455 @code{GNUTLS_CURVE_TO_BITS()}  macro.
5456
5457 For DSA keys, if the subgroup size needs to be specified check
5458 the @code{GNUTLS_SUBGROUP_TO_BITS()}  macro.
5459
5460 Do not set the number of bits directly, use @code{gnutls_sec_param_to_pk_bits()} .
5461
5462 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
5463 negative error value.
5464 @end deftypefun
5465
5466 @subheading gnutls_x509_privkey_get_key_id
5467 @anchor{gnutls_x509_privkey_get_key_id}
5468 @deftypefun {int} {gnutls_x509_privkey_get_key_id} (gnutls_x509_privkey_t @var{key}, unsigned int @var{flags}, unsigned char * @var{output_data}, size_t * @var{output_data_size})
5469 @var{key}: Holds the key
5470
5471 @var{flags}: should be 0 for now
5472
5473 @var{output_data}: will contain the key ID
5474
5475 @var{output_data_size}: holds the size of output_data (and will be
5476 replaced by the actual size of parameters)
5477
5478 This function will return a unique ID that depends on the public key
5479 parameters. This ID can be used in checking whether a certificate
5480 corresponds to the given key.
5481
5482 If the buffer provided is not long enough to hold the output, then
5483 * @code{output_data_size} is updated and @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  will
5484 be returned.  The output will normally be a SHA-1 hash output,
5485 which is 20 bytes.
5486
5487 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
5488 negative error value.
5489 @end deftypefun
5490
5491 @subheading gnutls_x509_privkey_get_pk_algorithm
5492 @anchor{gnutls_x509_privkey_get_pk_algorithm}
5493 @deftypefun {int} {gnutls_x509_privkey_get_pk_algorithm} (gnutls_x509_privkey_t @var{key})
5494 @var{key}: should contain a @code{gnutls_x509_privkey_t}  structure
5495
5496 This function will return the public key algorithm of a private
5497 key.
5498
5499 @strong{Returns:} a member of the @code{gnutls_pk_algorithm_t}  enumeration on
5500 success, or a negative error code on error.
5501 @end deftypefun
5502
5503 @subheading gnutls_x509_privkey_get_pk_algorithm2
5504 @anchor{gnutls_x509_privkey_get_pk_algorithm2}
5505 @deftypefun {int} {gnutls_x509_privkey_get_pk_algorithm2} (gnutls_x509_privkey_t @var{key}, unsigned int * @var{bits})
5506 @var{key}: should contain a @code{gnutls_x509_privkey_t}  structure
5507
5508 @var{bits}: The number of bits in the public key algorithm
5509
5510 This function will return the public key algorithm of a private
5511 key.
5512
5513 @strong{Returns:} a member of the @code{gnutls_pk_algorithm_t}  enumeration on
5514 success, or a negative error code on error.
5515 @end deftypefun
5516
5517 @subheading gnutls_x509_privkey_import
5518 @anchor{gnutls_x509_privkey_import}
5519 @deftypefun {int} {gnutls_x509_privkey_import} (gnutls_x509_privkey_t @var{key}, const gnutls_datum_t * @var{data}, gnutls_x509_crt_fmt_t @var{format})
5520 @var{key}: The structure to store the parsed key
5521
5522 @var{data}: The DER or PEM encoded certificate.
5523
5524 @var{format}: One of DER or PEM
5525
5526 This function will convert the given DER or PEM encoded key to the
5527 native @code{gnutls_x509_privkey_t}  format. The output will be stored in
5528  @code{key} .
5529
5530 If the key is PEM encoded it should have a header that contains "PRIVATE
5531 KEY". Note that this function falls back to PKCS @code{8}  decoding without
5532 password, if the default format fails to import.
5533
5534 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
5535 negative error value.
5536 @end deftypefun
5537
5538 @subheading gnutls_x509_privkey_import2
5539 @anchor{gnutls_x509_privkey_import2}
5540 @deftypefun {int} {gnutls_x509_privkey_import2} (gnutls_x509_privkey_t @var{key}, const gnutls_datum_t * @var{data}, gnutls_x509_crt_fmt_t @var{format}, const char * @var{password}, unsigned int @var{flags})
5541 @var{key}: The structure to store the parsed key
5542
5543 @var{data}: The DER or PEM encoded key.
5544
5545 @var{format}: One of DER or PEM
5546
5547 @var{password}: A password (optional)
5548
5549 @var{flags}: an ORed sequence of gnutls_pkcs_encrypt_flags_t
5550
5551 This function will import the given DER or PEM encoded key, to 
5552 the native @code{gnutls_x509_privkey_t}  format, irrespective of the
5553 input format. The input format is auto-detected.
5554
5555 The supported formats are basic unencrypted key, PKCS8, PKCS12,
5556 and the openssl format.
5557
5558 If the provided key is encrypted but no password was given, then
5559 @code{GNUTLS_E_DECRYPTION_FAILED}  is returned.
5560
5561 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
5562 negative error value.
5563 @end deftypefun
5564
5565 @subheading gnutls_x509_privkey_import_dsa_raw
5566 @anchor{gnutls_x509_privkey_import_dsa_raw}
5567 @deftypefun {int} {gnutls_x509_privkey_import_dsa_raw} (gnutls_x509_privkey_t @var{key}, const gnutls_datum_t * @var{p}, const gnutls_datum_t * @var{q}, const gnutls_datum_t * @var{g}, const gnutls_datum_t * @var{y}, const gnutls_datum_t * @var{x})
5568 @var{key}: The structure to store the parsed key
5569
5570 @var{p}: holds the p
5571
5572 @var{q}: holds the q
5573
5574 @var{g}: holds the g
5575
5576 @var{y}: holds the y
5577
5578 @var{x}: holds the x
5579
5580 This function will convert the given DSA raw parameters to the
5581 native @code{gnutls_x509_privkey_t}  format.  The output will be stored
5582 in  @code{key} .
5583
5584 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
5585 negative error value.
5586 @end deftypefun
5587
5588 @subheading gnutls_x509_privkey_import_ecc_raw
5589 @anchor{gnutls_x509_privkey_import_ecc_raw}
5590 @deftypefun {int} {gnutls_x509_privkey_import_ecc_raw} (gnutls_x509_privkey_t @var{key}, gnutls_ecc_curve_t @var{curve}, const gnutls_datum_t * @var{x}, const gnutls_datum_t * @var{y}, const gnutls_datum_t * @var{k})
5591 @var{key}: The structure to store the parsed key
5592
5593 @var{curve}: holds the curve
5594
5595 @var{x}: holds the x
5596
5597 @var{y}: holds the y
5598
5599 @var{k}: holds the k
5600
5601 This function will convert the given elliptic curve parameters to the
5602 native @code{gnutls_x509_privkey_t}  format.  The output will be stored
5603 in  @code{key} .
5604
5605 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
5606 negative error value.
5607
5608 @strong{Since:} 3.0
5609 @end deftypefun
5610
5611 @subheading gnutls_x509_privkey_import_openssl
5612 @anchor{gnutls_x509_privkey_import_openssl}
5613 @deftypefun {int} {gnutls_x509_privkey_import_openssl} (gnutls_x509_privkey_t @var{key}, const gnutls_datum_t * @var{data}, const char * @var{password})
5614 @var{key}: The structure to store the parsed key
5615
5616 @var{data}: The DER or PEM encoded key.
5617
5618 @var{password}: the password to decrypt the key (if it is encrypted).
5619
5620 This function will convert the given PEM encrypted to 
5621 the native gnutls_x509_privkey_t format. The
5622 output will be stored in  @code{key} .  
5623
5624 The  @code{password} should be in ASCII. If the password is not provided
5625 or wrong then @code{GNUTLS_E_DECRYPTION_FAILED}  will be returned.
5626
5627 If the Certificate is PEM encoded it should have a header of
5628 "PRIVATE KEY" and the "DEK-Info" header. 
5629
5630 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
5631 negative error value.
5632 @end deftypefun
5633
5634 @subheading gnutls_x509_privkey_import_pkcs8
5635 @anchor{gnutls_x509_privkey_import_pkcs8}
5636 @deftypefun {int} {gnutls_x509_privkey_import_pkcs8} (gnutls_x509_privkey_t @var{key}, const gnutls_datum_t * @var{data}, gnutls_x509_crt_fmt_t @var{format}, const char * @var{password}, unsigned int @var{flags})
5637 @var{key}: The structure to store the parsed key
5638
5639 @var{data}: The DER or PEM encoded key.
5640
5641 @var{format}: One of DER or PEM
5642
5643 @var{password}: the password to decrypt the key (if it is encrypted).
5644
5645 @var{flags}: 0 if encrypted or GNUTLS_PKCS_PLAIN if not encrypted.
5646
5647 This function will convert the given DER or PEM encoded PKCS8 2.0
5648 encrypted key to the native gnutls_x509_privkey_t format. The
5649 output will be stored in  @code{key} .  Both RSA and DSA keys can be
5650 imported, and flags can only be used to indicate an unencrypted
5651 key.
5652
5653 The  @code{password} can be either ASCII or UTF-8 in the default PBES2
5654 encryption schemas, or ASCII for the PKCS12 schemas.
5655
5656 If the Certificate is PEM encoded it should have a header of
5657 "ENCRYPTED PRIVATE KEY", or "PRIVATE KEY". You only need to
5658 specify the flags if the key is DER encoded, since in that case
5659 the encryption status cannot be auto-detected.
5660
5661 If the @code{GNUTLS_PKCS_PLAIN}  flag is specified and the supplied data
5662 are encrypted then @code{GNUTLS_E_DECRYPTION_FAILED}  is returned.
5663
5664 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
5665 negative error value.
5666 @end deftypefun
5667
5668 @subheading gnutls_x509_privkey_import_rsa_raw
5669 @anchor{gnutls_x509_privkey_import_rsa_raw}
5670 @deftypefun {int} {gnutls_x509_privkey_import_rsa_raw} (gnutls_x509_privkey_t @var{key}, const gnutls_datum_t * @var{m}, const gnutls_datum_t * @var{e}, const gnutls_datum_t * @var{d}, const gnutls_datum_t * @var{p}, const gnutls_datum_t * @var{q}, const gnutls_datum_t * @var{u})
5671 @var{key}: The structure to store the parsed key
5672
5673 @var{m}: holds the modulus
5674
5675 @var{e}: holds the public exponent
5676
5677 @var{d}: holds the private exponent
5678
5679 @var{p}: holds the first prime (p)
5680
5681 @var{q}: holds the second prime (q)
5682
5683 @var{u}: holds the coefficient
5684
5685 This function will convert the given RSA raw parameters to the
5686 native @code{gnutls_x509_privkey_t}  format.  The output will be stored in
5687  @code{key} .
5688
5689 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
5690 negative error value.
5691 @end deftypefun
5692
5693 @subheading gnutls_x509_privkey_import_rsa_raw2
5694 @anchor{gnutls_x509_privkey_import_rsa_raw2}
5695 @deftypefun {int} {gnutls_x509_privkey_import_rsa_raw2} (gnutls_x509_privkey_t @var{key}, const gnutls_datum_t * @var{m}, const gnutls_datum_t * @var{e}, const gnutls_datum_t * @var{d}, const gnutls_datum_t * @var{p}, const gnutls_datum_t * @var{q}, const gnutls_datum_t * @var{u}, const gnutls_datum_t * @var{e1}, const gnutls_datum_t * @var{e2})
5696 @var{key}: The structure to store the parsed key
5697
5698 @var{m}: holds the modulus
5699
5700 @var{e}: holds the public exponent
5701
5702 @var{d}: holds the private exponent
5703
5704 @var{p}: holds the first prime (p)
5705
5706 @var{q}: holds the second prime (q)
5707
5708 @var{u}: holds the coefficient (optional)
5709
5710 @var{e1}: holds e1 = d mod (p-1) (optional)
5711
5712 @var{e2}: holds e2 = d mod (q-1) (optional)
5713
5714 This function will convert the given RSA raw parameters to the
5715 native @code{gnutls_x509_privkey_t}  format.  The output will be stored in
5716  @code{key} .
5717
5718 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
5719 negative error value.
5720 @end deftypefun
5721
5722 @subheading gnutls_x509_privkey_init
5723 @anchor{gnutls_x509_privkey_init}
5724 @deftypefun {int} {gnutls_x509_privkey_init} (gnutls_x509_privkey_t * @var{key})
5725 @var{key}: The structure to be initialized
5726
5727 This function will initialize an private key structure.
5728
5729 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
5730 negative error value.
5731 @end deftypefun
5732
5733 @subheading gnutls_x509_privkey_sec_param
5734 @anchor{gnutls_x509_privkey_sec_param}
5735 @deftypefun {gnutls_sec_param_t} {gnutls_x509_privkey_sec_param} (gnutls_x509_privkey_t @var{key})
5736 @var{key}: a key structure
5737
5738 This function will return the security parameter appropriate with
5739 this private key.
5740
5741 @strong{Returns:} On success, a valid security parameter is returned otherwise
5742 @code{GNUTLS_SEC_PARAM_UNKNOWN}  is returned.
5743
5744 @strong{Since:} 2.12.0
5745 @end deftypefun
5746
5747 @subheading gnutls_x509_privkey_verify_params
5748 @anchor{gnutls_x509_privkey_verify_params}
5749 @deftypefun {int} {gnutls_x509_privkey_verify_params} (gnutls_x509_privkey_t @var{key})
5750 @var{key}: should contain a @code{gnutls_x509_privkey_t}  structure
5751
5752 This function will verify the private key parameters.
5753
5754 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
5755 negative error value.
5756 @end deftypefun
5757
5758 @subheading gnutls_x509_rdn_get
5759 @anchor{gnutls_x509_rdn_get}
5760 @deftypefun {int} {gnutls_x509_rdn_get} (const gnutls_datum_t * @var{idn}, char * @var{buf}, size_t * @var{buf_size})
5761 @var{idn}: should contain a DER encoded RDN sequence
5762
5763 @var{buf}: a pointer to a structure to hold the peer's name
5764
5765 @var{buf_size}: holds the size of  @code{buf} 
5766
5767 This function will return the name of the given RDN sequence.  The
5768 name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as described in
5769 RFC4514.
5770
5771 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, or
5772 @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  is returned and * @code{buf_size} is
5773 updated if the provided buffer is not long enough, otherwise a
5774 negative error value.
5775 @end deftypefun
5776
5777 @subheading gnutls_x509_rdn_get_by_oid
5778 @anchor{gnutls_x509_rdn_get_by_oid}
5779 @deftypefun {int} {gnutls_x509_rdn_get_by_oid} (const gnutls_datum_t * @var{idn}, const char * @var{oid}, int @var{indx}, unsigned int @var{raw_flag}, void * @var{buf}, size_t * @var{buf_size})
5780 @var{idn}: should contain a DER encoded RDN sequence
5781
5782 @var{oid}: an Object Identifier
5783
5784 @var{indx}: In case multiple same OIDs exist in the RDN indicates which
5785 to send. Use 0 for the first one.
5786
5787 @var{raw_flag}: If non-zero then the raw DER data are returned.
5788
5789 @var{buf}: a pointer to a structure to hold the peer's name
5790
5791 @var{buf_size}: holds the size of  @code{buf} 
5792
5793 This function will return the name of the given Object identifier,
5794 of the RDN sequence.  The name will be encoded using the rules
5795 from RFC4514.
5796
5797 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, or
5798 @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  is returned and * @code{buf_size} is
5799 updated if the provided buffer is not long enough, otherwise a
5800 negative error value.
5801 @end deftypefun
5802
5803 @subheading gnutls_x509_rdn_get_oid
5804 @anchor{gnutls_x509_rdn_get_oid}
5805 @deftypefun {int} {gnutls_x509_rdn_get_oid} (const gnutls_datum_t * @var{idn}, int @var{indx}, void * @var{buf}, size_t * @var{buf_size})
5806 @var{idn}: should contain a DER encoded RDN sequence
5807
5808 @var{indx}: Indicates which OID to return. Use 0 for the first one.
5809
5810 @var{buf}: a pointer to a structure to hold the peer's name OID
5811
5812 @var{buf_size}: holds the size of  @code{buf} 
5813
5814 This function will return the specified Object identifier, of the
5815 RDN sequence.
5816
5817 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, or
5818 @code{GNUTLS_E_SHORT_MEMORY_BUFFER}  is returned and * @code{buf_size} is
5819 updated if the provided buffer is not long enough, otherwise a
5820 negative error value.
5821
5822 @strong{Since:} 2.4.0
5823 @end deftypefun
5824
5825 @subheading gnutls_x509_trust_list_add_cas
5826 @anchor{gnutls_x509_trust_list_add_cas}
5827 @deftypefun {int} {gnutls_x509_trust_list_add_cas} (gnutls_x509_trust_list_t @var{list}, const gnutls_x509_crt_t * @var{clist}, unsigned @var{clist_size}, unsigned int @var{flags})
5828 @var{list}: The structure of the list
5829
5830 @var{clist}: A list of CAs
5831
5832 @var{clist_size}: The length of the CA list
5833
5834 @var{flags}: should be 0 or an or'ed sequence of @code{GNUTLS_TL}  options.
5835
5836 This function will add the given certificate authorities
5837 to the trusted list. The list of CAs must not be deinitialized
5838 during this structure's lifetime.
5839
5840 If the flag @code{GNUTLS_TL_NO_DUPLICATES}  is specified, then
5841 the provided  @code{clist} entries that are duplicates will not be
5842 added to the list and will be deinitialized.
5843
5844 @strong{Returns:} The number of added elements is returned.
5845
5846 @strong{Since:} 3.0.0
5847 @end deftypefun
5848
5849 @subheading gnutls_x509_trust_list_add_crls
5850 @anchor{gnutls_x509_trust_list_add_crls}
5851 @deftypefun {int} {gnutls_x509_trust_list_add_crls} (gnutls_x509_trust_list_t @var{list}, const gnutls_x509_crl_t * @var{crl_list}, int @var{crl_size}, unsigned int @var{flags}, unsigned int @var{verification_flags})
5852 @var{list}: The structure of the list
5853
5854 @var{crl_list}: A list of CRLs
5855
5856 @var{crl_size}: The length of the CRL list
5857
5858 @var{flags}: if GNUTLS_TL_VERIFY_CRL is given the CRLs will be verified before being added.
5859
5860 @var{verification_flags}: gnutls_certificate_verify_flags if flags specifies GNUTLS_TL_VERIFY_CRL
5861
5862 This function will add the given certificate revocation lists
5863 to the trusted list. The list of CRLs must not be deinitialized
5864 during this structure's lifetime.
5865
5866 This function must be called after @code{gnutls_x509_trust_list_add_cas()} 
5867 to allow verifying the CRLs for validity.
5868
5869 @strong{Returns:} The number of added elements is returned.
5870
5871 @strong{Since:} 3.0
5872 @end deftypefun
5873
5874 @subheading gnutls_x509_trust_list_add_named_crt
5875 @anchor{gnutls_x509_trust_list_add_named_crt}
5876 @deftypefun {int} {gnutls_x509_trust_list_add_named_crt} (gnutls_x509_trust_list_t @var{list}, gnutls_x509_crt_t @var{cert}, const void * @var{name}, size_t @var{name_size}, unsigned int @var{flags})
5877 @var{list}: The structure of the list
5878
5879 @var{cert}: A certificate
5880
5881 @var{name}: An identifier for the certificate
5882
5883 @var{name_size}: The size of the identifier
5884
5885 @var{flags}: should be 0.
5886
5887 This function will add the given certificate to the trusted
5888 list and associate it with a name. The certificate will not be
5889 be used for verification with @code{gnutls_x509_trust_list_verify_crt()} 
5890 but only with @code{gnutls_x509_trust_list_verify_named_crt()} .
5891
5892 In principle this function can be used to set individual "server"
5893 certificates that are trusted by the user for that specific server
5894 but for no other purposes.
5895
5896 The certificate must not be deinitialized during the lifetime
5897 of the trusted list.
5898
5899 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
5900 negative error value.
5901
5902 @strong{Since:} 3.0.0
5903 @end deftypefun
5904
5905 @subheading gnutls_x509_trust_list_add_system_trust
5906 @anchor{gnutls_x509_trust_list_add_system_trust}
5907 @deftypefun {int} {gnutls_x509_trust_list_add_system_trust} (gnutls_x509_trust_list_t @var{list}, unsigned int @var{tl_flags}, unsigned int @var{tl_vflags})
5908 @var{list}: The structure of the list
5909
5910 @var{tl_flags}: GNUTLS_TL_*
5911
5912 @var{tl_vflags}: gnutls_certificate_verify_flags if flags specifies GNUTLS_TL_VERIFY_CRL
5913
5914 This function adds the system's default trusted certificate
5915 authorities to the trusted list. Note that on unsupported system
5916 this function returns @code{GNUTLS_E_UNIMPLEMENTED_FEATURE} .
5917
5918 @strong{Returns:} The number of added elements or a negative error code on error.
5919
5920 @strong{Since:} 3.1
5921 @end deftypefun
5922
5923 @subheading gnutls_x509_trust_list_add_trust_file
5924 @anchor{gnutls_x509_trust_list_add_trust_file}
5925 @deftypefun {int} {gnutls_x509_trust_list_add_trust_file} (gnutls_x509_trust_list_t @var{list}, const char * @var{ca_file}, const char * @var{crl_file}, gnutls_x509_crt_fmt_t @var{type}, unsigned int @var{tl_flags}, unsigned int @var{tl_vflags})
5926 @var{list}: The structure of the list
5927
5928 @var{ca_file}: A file containing a list of CAs (optional)
5929
5930 @var{crl_file}: A file containing a list of CRLs (optional)
5931
5932 @var{type}: The format of the certificates
5933
5934 @var{tl_flags}: GNUTLS_TL_*
5935
5936 @var{tl_vflags}: gnutls_certificate_verify_flags if flags specifies GNUTLS_TL_VERIFY_CRL
5937
5938 This function will add the given certificate authorities
5939 to the trusted list. pkcs11 URLs are also accepted, instead
5940 of files, by this function.
5941
5942 @strong{Returns:} The number of added elements is returned.
5943
5944 @strong{Since:} 3.1
5945 @end deftypefun
5946
5947 @subheading gnutls_x509_trust_list_add_trust_mem
5948 @anchor{gnutls_x509_trust_list_add_trust_mem}
5949 @deftypefun {int} {gnutls_x509_trust_list_add_trust_mem} (gnutls_x509_trust_list_t @var{list}, const gnutls_datum_t * @var{cas}, const gnutls_datum_t * @var{crls}, gnutls_x509_crt_fmt_t @var{type}, unsigned int @var{tl_flags}, unsigned int @var{tl_vflags})
5950 @var{list}: The structure of the list
5951
5952 @var{cas}: A buffer containing a list of CAs (optional)
5953
5954 @var{crls}: A buffer containing a list of CRLs (optional)
5955
5956 @var{type}: The format of the certificates
5957
5958 @var{tl_flags}: GNUTLS_TL_*
5959
5960 @var{tl_vflags}: gnutls_certificate_verify_flags if flags specifies GNUTLS_TL_VERIFY_CRL
5961
5962 This function will add the given certificate authorities
5963 to the trusted list. 
5964
5965 @strong{Returns:} The number of added elements is returned.
5966
5967 @strong{Since:} 3.1
5968 @end deftypefun
5969
5970 @subheading gnutls_x509_trust_list_deinit
5971 @anchor{gnutls_x509_trust_list_deinit}
5972 @deftypefun {void} {gnutls_x509_trust_list_deinit} (gnutls_x509_trust_list_t @var{list}, unsigned int @var{all})
5973 @var{list}: The structure to be deinitialized
5974
5975 @var{all}: if non-zero it will deinitialize all the certificates and CRLs contained in the structure.
5976
5977 This function will deinitialize a trust list. Note that the
5978  @code{all} flag should be typically non-zero unless you have specified
5979 your certificates using @code{gnutls_x509_trust_list_add_cas()}  and you
5980 want to prevent them from being deinitialized by this function.
5981
5982 @strong{Since:} 3.0.0
5983 @end deftypefun
5984
5985 @subheading gnutls_x509_trust_list_get_issuer
5986 @anchor{gnutls_x509_trust_list_get_issuer}
5987 @deftypefun {int} {gnutls_x509_trust_list_get_issuer} (gnutls_x509_trust_list_t @var{list}, gnutls_x509_crt_t @var{cert}, gnutls_x509_crt_t * @var{issuer}, unsigned int @var{flags})
5988 @var{list}: The structure of the list
5989
5990 @var{cert}: is the certificate to find issuer for
5991
5992 @var{issuer}: Will hold the issuer if any. Should be treated as constant.
5993
5994 @var{flags}: Use zero.
5995
5996 This function will attempt to find the issuer of the
5997 given certificate.
5998
5999 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
6000 negative error value.
6001
6002 @strong{Since:} 3.0
6003 @end deftypefun
6004
6005 @subheading gnutls_x509_trust_list_init
6006 @anchor{gnutls_x509_trust_list_init}
6007 @deftypefun {int} {gnutls_x509_trust_list_init} (gnutls_x509_trust_list_t * @var{list}, unsigned int @var{size})
6008 @var{list}: The structure to be initialized
6009
6010 @var{size}: The size of the internal hash table. Use (0) for default size.
6011
6012 This function will initialize an X.509 trust list structure.
6013
6014 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
6015 negative error value.
6016
6017 @strong{Since:} 3.0.0
6018 @end deftypefun
6019
6020 @subheading gnutls_x509_trust_list_remove_cas
6021 @anchor{gnutls_x509_trust_list_remove_cas}
6022 @deftypefun {int} {gnutls_x509_trust_list_remove_cas} (gnutls_x509_trust_list_t @var{list}, const gnutls_x509_crt_t * @var{clist}, int @var{clist_size})
6023 @var{list}: The structure of the list
6024
6025 @var{clist}: A list of CAs
6026
6027 @var{clist_size}: The length of the CA list
6028
6029 This function will remove the given certificate authorities
6030 from the trusted list.
6031
6032 Note that this function can accept certificates and authorities
6033 not yet known. In that case they will be kept in a separate
6034 black list that will be used during certificate verification.
6035 Unlike @code{gnutls_x509_trust_list_add_cas()}  there is no deinitialization
6036 restriction for  certificate list provided in this function.
6037
6038 @strong{Returns:} The number of removed elements is returned.
6039
6040 @strong{Since:} 3.1.10
6041 @end deftypefun
6042
6043 @subheading gnutls_x509_trust_list_remove_trust_file
6044 @anchor{gnutls_x509_trust_list_remove_trust_file}
6045 @deftypefun {int} {gnutls_x509_trust_list_remove_trust_file} (gnutls_x509_trust_list_t @var{list}, const char * @var{ca_file}, gnutls_x509_crt_fmt_t @var{type})
6046 @var{list}: The structure of the list
6047
6048 @var{ca_file}: A file containing a list of CAs
6049
6050 @var{type}: The format of the certificates
6051
6052 This function will remove the given certificate authorities
6053 from the trusted list, and add them into a black list when needed. 
6054 PKCS 11 URLs are also accepted, instead
6055 of files, by this function.
6056
6057 See also @code{gnutls_x509_trust_list_remove_cas()} .
6058
6059 @strong{Returns:} The number of added elements is returned.
6060
6061 @strong{Since:} 3.1.10
6062 @end deftypefun
6063
6064 @subheading gnutls_x509_trust_list_remove_trust_mem
6065 @anchor{gnutls_x509_trust_list_remove_trust_mem}
6066 @deftypefun {int} {gnutls_x509_trust_list_remove_trust_mem} (gnutls_x509_trust_list_t @var{list}, const gnutls_datum_t * @var{cas}, gnutls_x509_crt_fmt_t @var{type})
6067 @var{list}: The structure of the list
6068
6069 @var{cas}: A buffer containing a list of CAs (optional)
6070
6071 @var{type}: The format of the certificates
6072
6073 This function will remove the provided certificate authorities
6074 from the trusted list, and add them into a black list when needed. 
6075
6076 See also @code{gnutls_x509_trust_list_remove_cas()} .
6077
6078 @strong{Returns:} The number of removed elements is returned.
6079
6080 @strong{Since:} 3.1.10
6081 @end deftypefun
6082
6083 @subheading gnutls_x509_trust_list_verify_crt
6084 @anchor{gnutls_x509_trust_list_verify_crt}
6085 @deftypefun {int} {gnutls_x509_trust_list_verify_crt} (gnutls_x509_trust_list_t @var{list}, gnutls_x509_crt_t * @var{cert_list}, unsigned int @var{cert_list_size}, unsigned int @var{flags}, unsigned int * @var{voutput}, gnutls_verify_output_function @var{func})
6086 @var{list}: The structure of the list
6087
6088 @var{cert_list}: is the certificate list to be verified
6089
6090 @var{cert_list_size}: is the certificate list size
6091
6092 @var{flags}: Flags that may be used to change the verification algorithm. Use OR of the gnutls_certificate_verify_flags enumerations.
6093
6094 @var{voutput}: will hold the certificate verification output.
6095
6096 @var{func}: If non-null will be called on each chain element verification with the output.
6097
6098 This function will try to verify the given certificate and return
6099 its status. The  @code{verify} parameter will hold an OR'ed sequence of
6100 @code{gnutls_certificate_status_t}  flags.
6101
6102 Additionally a certificate verification profile can be specified
6103 from the ones in @code{gnutls_certificate_verification_profiles_t}  by
6104 ORing the result of @code{GNUTLS_PROFILE_TO_VFLAGS()}  to the verification
6105 flags.
6106
6107 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
6108 negative error value.
6109
6110 @strong{Since:} 3.0
6111 @end deftypefun
6112
6113 @subheading gnutls_x509_trust_list_verify_named_crt
6114 @anchor{gnutls_x509_trust_list_verify_named_crt}
6115 @deftypefun {int} {gnutls_x509_trust_list_verify_named_crt} (gnutls_x509_trust_list_t @var{list}, gnutls_x509_crt_t @var{cert}, const void * @var{name}, size_t @var{name_size}, unsigned int @var{flags}, unsigned int * @var{voutput}, gnutls_verify_output_function @var{func})
6116 @var{list}: The structure of the list
6117
6118 @var{cert}: is the certificate to be verified
6119
6120 @var{name}: is the certificate's name
6121
6122 @var{name_size}: is the certificate's name size
6123
6124 @var{flags}: Flags that may be used to change the verification algorithm. Use OR of the gnutls_certificate_verify_flags enumerations.
6125
6126 @var{voutput}: will hold the certificate verification output.
6127
6128 @var{func}: If non-null will be called on each chain element verification with the output.
6129
6130 This function will try to find a certificate that is associated with the provided
6131 name --see @code{gnutls_x509_trust_list_add_named_crt()} . If a match is found the certificate is considered valid. 
6132 In addition to that this function will also check CRLs. 
6133 The  @code{voutput} parameter will hold an OR'ed sequence of @code{gnutls_certificate_status_t}  flags.
6134
6135 Additionally a certificate verification profile can be specified
6136 from the ones in @code{gnutls_certificate_verification_profiles_t}  by
6137 ORing the result of @code{GNUTLS_PROFILE_TO_VFLAGS()}  to the verification
6138 flags.
6139
6140 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
6141 negative error value.
6142
6143 @strong{Since:} 3.0.0
6144 @end deftypefun
6145