libksba  1.6.0
About: KSBA is a library to make the tasks of working with X.509 certificates, CMS data and related objects more easy.
  Fossies Dox: libksba-1.6.0.tar.bz2  ("unofficial" and yet experimental doxygen-generated source code documentation)  

ksba.h
Go to the documentation of this file.
1 /* ksba.h - X.509 library used by GnuPG
2  * Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2010, 2011
3  * 2012, 2013, 2104, 2015, 2019, 2020, 2021 g10 Code GmbH
4  *
5  * This file is part of KSBA.
6  *
7  * KSBA is free software; you can redistribute it and/or modify
8  * it under the terms of either
9  *
10  * - the GNU Lesser General Public License as published by the Free
11  * Software Foundation; either version 3 of the License, or (at
12  * your option) any later version.
13  *
14  * or
15  *
16  * - the GNU General Public License as published by the Free
17  * Software Foundation; either version 2 of the License, or (at
18  * your option) any later version.
19  *
20  * or both in parallel, as here.
21  *
22  * KSBA is distributed in the hope that it will be useful, but WITHOUT
23  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
25  * License for more details.
26  *
27  * You should have received a copies of the GNU General Public License
28  * and the GNU Lesser General Public License along with this program;
29  * if not, see <http://www.gnu.org/licenses/>.
30  * SPDX-License-Identifier: LGPL-3.0-or-later OR GPL-2.0-or-later
31  */
32 
33 #ifndef KSBA_H
34 #define KSBA_H 1
35 
36 #include <gpg-error.h>
37 #include <stdio.h>
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #if 0
42  }
43 #endif
44 #endif
45 
46 /* The version of this header should match the one of the library. Do
47  * not use this symbol in your application; use assuan_check_version
48  * instead. */
49 #define KSBA_VERSION "1.6.0"
50 
51 /* The version number of this header. It may be used to handle minor
52  * API incompatibilities. */
53 #define KSBA_VERSION_NUMBER 0x010600
54 
55 
56 
57 /* Check for compiler features. */
58 #ifdef __GNUC__
59 #define _KSBA_GCC_VERSION (__GNUC__ * 10000 \
60  + __GNUC_MINOR__ * 100 \
61  + __GNUC_PATCHLEVEL__)
62 #if _KSBA_GCC_VERSION > 30100
63 #define _KSBA_DEPRECATED __attribute__ ((__deprecated__))
64 #endif
65 #endif /*__GNUC__*/
66 
67 #ifndef _KSBA_DEPRECATED
68 #define _KSBA_DEPRECATED
69 #endif
70 
71 
72 #define KSBA_CLASS_UNIVERSAL 0
73 #define KSBA_CLASS_APPLICATION 1
74 #define KSBA_CLASS_CONTEXT 2
75 #define KSBA_CLASS_PRIVATE 3
76 #define KSBA_CLASS_ENCAPSULATE 0x80 /* Pseudo class. */
77 
78 #define KSBA_TYPE_BOOLEAN 1
79 #define KSBA_TYPE_INTEGER 2
80 #define KSBA_TYPE_BIT_STRING 3
81 #define KSBA_TYPE_OCTET_STRING 4
82 #define KSBA_TYPE_NULL 5
83 #define KSBA_TYPE_OBJECT_ID 6
84 #define KSBA_TYPE_OBJECT_DESCRIPTOR 7
85 #define KSBA_TYPE_EXTERNAL 8
86 #define KSBA_TYPE_REAL 9
87 #define KSBA_TYPE_ENUMERATED 10
88 #define KSBA_TYPE_EMBEDDED_PDV 11
89 #define KSBA_TYPE_UTF8_STRING 12
90 #define KSBA_TYPE_RELATIVE_OID 13
91 #define KSBA_TYPE_TIME 14
92 #define KSBA_TYPE_SEQUENCE 16
93 #define KSBA_TYPE_SET 17
94 #define KSBA_TYPE_NUMERIC_STRING 18
95 #define KSBA_TYPE_PRINTABLE_STRING 19
96 #define KSBA_TYPE_TELETEX_STRING 20
97 #define KSBA_TYPE_VIDEOTEX_STRING 21
98 #define KSBA_TYPE_IA5_STRING 22
99 #define KSBA_TYPE_UTC_TIME 23
100 #define KSBA_TYPE_GENERALIZED_TIME 24
101 #define KSBA_TYPE_GRAPHIC_STRING 25
102 #define KSBA_TYPE_VISIBLE_STRING 26
103 #define KSBA_TYPE_GENERAL_STRING 27
104 #define KSBA_TYPE_UNIVERSAL_STRING 28
105 #define KSBA_TYPE_CHARACTER_STRING 29
106 #define KSBA_TYPE_BMP_STRING 30
107 #define KSBA_TYPE_DATE 31
108 #define KSBA_TYPE_TIME_OF_DAY 32
109 #define KSBA_TYPE_DATE_TIME 33
110 #define KSBA_TYPE_DURATION 34
111 #define KSBA_TYPE_OID_IRI 35
112 #define KSBA_TYPE_RELATIVE_OID_IRI 36
113 
114 
115 
116 typedef gpg_error_t KsbaError _KSBA_DEPRECATED;
117 
118 typedef enum
119  {
131  }
134 
135 
136 
137 typedef enum
138  {
139  KSBA_SR_NONE = 0, /* Never seen by libksba user. */
140  KSBA_SR_RUNNING = 1, /* Never seen by libksba user. */
150  KSBA_SR_END_ITEMS = 11
151  }
154 
155 typedef enum
156  {
167  KSBA_CRLREASON_OTHER = 32768
168  }
171 
172 typedef enum
173  {
183  }
185 
186 typedef enum
187  {
192  }
194 
195 
196 typedef enum
197  {
207  }
210 
211 /* ISO format, e.g. "19610711T172059", assumed to be UTC. */
212 typedef char ksba_isotime_t[16];
213 
214 
215 /* X.509 certificates are represented by this object.
216  ksba_cert_new() creates such an object */
217 struct ksba_cert_s;
218 typedef struct ksba_cert_s *ksba_cert_t;
220 
221 /* CMS objects are controlled by this object.
222  ksba_cms_new() creates it */
223 struct ksba_cms_s;
224 typedef struct ksba_cms_s *ksba_cms_t;
226 
227 /* CRL objects are controlled by this object.
228  ksba_crl_new() creates it */
229 struct ksba_crl_s;
230 typedef struct ksba_crl_s *ksba_crl_t;
232 
233 /* OCSP objects are controlled by this object.
234  ksba_ocsp_new() creates it. */
235 struct ksba_ocsp_s;
236 typedef struct ksba_ocsp_s *ksba_ocsp_t;
237 
238 /* PKCS-10 creation is controlled by this object.
239  ksba_certreq_new() creates it */
240 struct ksba_certreq_s;
243 
244 /* This is a reader object for various purposes
245  see ksba_reader_new et al. */
246 struct ksba_reader_s;
247 typedef struct ksba_reader_s *ksba_reader_t;
249 
250 /* This is a writer object for various purposes
251  see ksba_writer_new et al. */
252 struct ksba_writer_s;
253 typedef struct ksba_writer_s *ksba_writer_t;
255 
256 /* This is an object to store an ASN.1 parse tree as
257  create by ksba_asn_parse_file() */
258 struct ksba_asn_tree_s;
261 
262 /* This is an object to reference a General Name. Such an object is
263  returned by several functions. */
264 struct ksba_name_s;
265 typedef struct ksba_name_s *ksba_name_t;
267 
268 /* KsbaSexp is just an unsigned char * which should be used for
269  documentation purpose. The S-expressions returned by libksba are
270  always in canonical representation with an extra 0 byte at the end,
271  so that one can print the values in the debugger and at least see
272  the first bytes */
273 typedef unsigned char *ksba_sexp_t;
274 typedef unsigned char *KsbaSexp _KSBA_DEPRECATED;
275 typedef const unsigned char *ksba_const_sexp_t;
276 typedef const unsigned char *KsbaConstSexp _KSBA_DEPRECATED;
277 
278 
279 /* This is a generic object used by various functions. */
280 struct ksba_der_s;
281 typedef struct ksba_der_s *ksba_der_t;
282 
283 
284 /*-- cert.c --*/
285 gpg_error_t ksba_cert_new (ksba_cert_t *acert);
288 gpg_error_t ksba_cert_set_user_data (ksba_cert_t cert, const char *key,
289  const void *data, size_t datalen);
290 gpg_error_t ksba_cert_get_user_data (ksba_cert_t cert, const char *key,
291  void *buffer, size_t bufferlen,
292  size_t *datalen);
293 
294 gpg_error_t ksba_cert_read_der (ksba_cert_t cert, ksba_reader_t reader);
296  const void *buffer, size_t length);
297 const unsigned char *ksba_cert_get_image (ksba_cert_t cert, size_t *r_length);
298 gpg_error_t ksba_cert_hash (ksba_cert_t cert,
299  int what,
300  void (*hasher)(void *,
301  const void *,
302  size_t length),
303  void *hasher_arg);
306 char *ksba_cert_get_issuer (ksba_cert_t cert, int idx);
307 gpg_error_t ksba_cert_get_validity (ksba_cert_t cert, int what,
308  ksba_isotime_t r_time);
309 char *ksba_cert_get_subject (ksba_cert_t cert, int idx);
312 
313 gpg_error_t ksba_cert_get_extension (ksba_cert_t cert, int idx,
314  char const **r_oid, int *r_crit,
315  size_t *r_deroff, size_t *r_derlen);
316 
317 gpg_error_t ksba_cert_is_ca (ksba_cert_t cert, int *r_ca, int *r_pathlen);
318 gpg_error_t ksba_cert_get_key_usage (ksba_cert_t cert, unsigned int *r_flags);
319 gpg_error_t ksba_cert_get_cert_policies (ksba_cert_t cert, char **r_policies);
320 gpg_error_t ksba_cert_get_ext_key_usages (ksba_cert_t cert, char **result);
321 gpg_error_t ksba_cert_get_crl_dist_point (ksba_cert_t cert, int idx,
322  ksba_name_t *r_distpoint,
323  ksba_name_t *r_issuer,
324  ksba_crl_reason_t *r_reason);
326  ksba_sexp_t *r_keyid,
327  ksba_name_t *r_name,
328  ksba_sexp_t *r_serial);
330  int *r_crit,
331  ksba_sexp_t *r_keyid);
333  char **r_method,
334  ksba_name_t *r_location);
336  char **r_method,
337  ksba_name_t *r_location);
338 
339 
340 /*-- cms.c --*/
342 
343 gpg_error_t ksba_cms_new (ksba_cms_t *r_cms);
347 
348 gpg_error_t ksba_cms_parse (ksba_cms_t cms, ksba_stop_reason_t *r_stopreason);
349 gpg_error_t ksba_cms_build (ksba_cms_t cms, ksba_stop_reason_t *r_stopreason);
350 
352 const char *ksba_cms_get_content_oid (ksba_cms_t cms, int what);
353 gpg_error_t ksba_cms_get_content_enc_iv (ksba_cms_t cms, void *iv,
354  size_t maxivlen, size_t *ivlen);
355 const char *ksba_cms_get_digest_algo_list (ksba_cms_t cms, int idx);
356 gpg_error_t ksba_cms_get_issuer_serial (ksba_cms_t cms, int idx,
357  char **r_issuer,
358  ksba_sexp_t *r_serial);
359 const char *ksba_cms_get_digest_algo (ksba_cms_t cms, int idx);
361 gpg_error_t ksba_cms_get_message_digest (ksba_cms_t cms, int idx,
362  char **r_digest, size_t *r_digest_len);
363 gpg_error_t ksba_cms_get_signing_time (ksba_cms_t cms, int idx,
364  ksba_isotime_t r_sigtime);
365 gpg_error_t ksba_cms_get_sigattr_oids (ksba_cms_t cms, int idx,
366  const char *reqoid, char **r_value);
369 
371  void (*hash_fnc)(void *, const void *, size_t),
372  void *hash_fnc_arg);
373 
374 gpg_error_t ksba_cms_hash_signed_attrs (ksba_cms_t cms, int idx);
375 
376 
377 gpg_error_t ksba_cms_set_content_type (ksba_cms_t cms, int what,
378  ksba_content_type_t type);
379 gpg_error_t ksba_cms_add_digest_algo (ksba_cms_t cms, const char *oid);
381 gpg_error_t ksba_cms_add_cert (ksba_cms_t cms, ksba_cert_t cert);
382 gpg_error_t ksba_cms_add_smime_capability (ksba_cms_t cms, const char *oid,
383  const unsigned char *der,
384  size_t derlen);
385 gpg_error_t ksba_cms_set_message_digest (ksba_cms_t cms, int idx,
386  const unsigned char *digest,
387  size_t digest_len);
388 gpg_error_t ksba_cms_set_signing_time (ksba_cms_t cms, int idx,
389  const ksba_isotime_t sigtime);
391  int idx, ksba_const_sexp_t sigval);
392 
394  const char *oid,
395  const void *iv,
396  size_t ivlen);
399  int idx, ksba_const_sexp_t encval);
400 
401 
402 /*-- crl.c --*/
403 gpg_error_t ksba_crl_new (ksba_crl_t *r_crl);
407  void (*hash_fnc)(void *,
408  const void *, size_t),
409  void *hash_fnc_arg);
411 gpg_error_t ksba_crl_get_issuer (ksba_crl_t crl, char **r_issuer);
412 gpg_error_t ksba_crl_get_extension (ksba_crl_t crl, int idx,
413  char const **oid, int *critical,
414  unsigned char const **der, size_t *derlen);
416  ksba_sexp_t *r_keyid,
417  ksba_name_t *r_name,
418  ksba_sexp_t *r_serial);
419 gpg_error_t ksba_crl_get_crl_number (ksba_crl_t crl, ksba_sexp_t *number);
421  ksba_isotime_t this_update,
422  ksba_isotime_t next_update);
423 gpg_error_t ksba_crl_get_item (ksba_crl_t crl,
424  ksba_sexp_t *r_serial,
425  ksba_isotime_t r_revocation_date,
426  ksba_crl_reason_t *r_reason);
428 gpg_error_t ksba_crl_parse (ksba_crl_t crl, ksba_stop_reason_t *r_stopreason);
429 
430 
431 
432 /*-- ocsp.c --*/
433 gpg_error_t ksba_ocsp_new (ksba_ocsp_t *r_oscp);
435 gpg_error_t ksba_ocsp_set_digest_algo (ksba_ocsp_t ocsp, const char *oid);
438  ksba_cert_t cert, ksba_cert_t issuer_cert);
440  unsigned char *nonce, size_t noncelen);
441 
444  void (*hasher)(void *, const void *,
445  size_t length),
446  void *hasher_arg);
448  ksba_const_sexp_t sigval);
449 gpg_error_t ksba_ocsp_add_cert (ksba_ocsp_t ocsp, ksba_cert_t cert);
451  unsigned char **r_buffer,
452  size_t *r_buflen);
453 
455  const unsigned char *msg, size_t msglen,
456  ksba_ocsp_response_status_t *resp_status);
457 
460  const unsigned char *msg, size_t msglen,
461  void (*hasher)(void *, const void *,
462  size_t length),
463  void *hasher_arg);
465  ksba_isotime_t produced_at);
467  char **r_name,
468  ksba_sexp_t *r_keyid);
471  ksba_status_t *r_status,
472  ksba_isotime_t r_this_update,
473  ksba_isotime_t r_next_update,
474  ksba_isotime_t r_revocation_time,
475  ksba_crl_reason_t *r_reason);
477  int idx,
478  char const **r_oid, int *r_crit,
479  unsigned char const **r_der,
480  size_t *r_derlen);
481 
482 
483 /*-- certreq.c --*/
484 gpg_error_t ksba_certreq_new (ksba_certreq_t *r_cr);
488  ksba_certreq_t cr,
489  void (*hash_fnc)(void *, const void *, size_t),
490  void *hash_fnc_arg);
491 gpg_error_t ksba_certreq_add_subject (ksba_certreq_t cr, const char *name);
493  ksba_const_sexp_t key);
495  const char *oid, int is_crit,
496  const void *der,
497  size_t derlen);
499  ksba_const_sexp_t sigval);
501  ksba_stop_reason_t *r_stopreason);
502 
503 /* The functions below are used to switch to X.509 certificate creation. */
505 gpg_error_t ksba_certreq_set_issuer (ksba_certreq_t cr, const char *name);
506 gpg_error_t ksba_certreq_set_validity (ksba_certreq_t cr, int what,
507  const ksba_isotime_t timebuf);
509  ksba_const_sexp_t siginfo);
510 
511 
512 
513 /*-- reader.c --*/
514 gpg_error_t ksba_reader_new (ksba_reader_t *r_r);
517  void (*notify)(void*,ksba_reader_t),
518  void *notify_value);
520  unsigned char **buffer, size_t *buflen);
522 
524  const void *buffer, size_t length);
525 gpg_error_t ksba_reader_set_fd (ksba_reader_t r, int fd);
526 gpg_error_t ksba_reader_set_file (ksba_reader_t r, FILE *fp);
528  int (*cb)(void*,char *,size_t,size_t*),
529  void *cb_value );
530 
532  char *buffer, size_t length, size_t *nread);
533 gpg_error_t ksba_reader_unread (ksba_reader_t r, const void *buffer, size_t count);
534 unsigned long ksba_reader_tell (ksba_reader_t r);
535 
536 /*-- writer.c --*/
537 gpg_error_t ksba_writer_new (ksba_writer_t *r_w);
540  void (*notify)(void*,ksba_writer_t),
541  void *notify_value);
543 unsigned long ksba_writer_tell (ksba_writer_t w);
544 gpg_error_t ksba_writer_set_fd (ksba_writer_t w, int fd);
545 gpg_error_t ksba_writer_set_file (ksba_writer_t w, FILE *fp);
547  int (*cb)(void*,const void *,size_t),
548  void *cb_value);
549 gpg_error_t ksba_writer_set_mem (ksba_writer_t w, size_t initial_size);
550 const void *ksba_writer_get_mem (ksba_writer_t w, size_t *nbytes);
551 void * ksba_writer_snatch_mem (ksba_writer_t w, size_t *nbytes);
553  gpg_error_t (*filter)(void*,
554  const void *,size_t, size_t *,
555  void *, size_t, size_t *),
556  void *filter_arg);
557 
558 gpg_error_t ksba_writer_write (ksba_writer_t w, const void *buffer, size_t length);
560  const void *buffer, size_t length,
561  int flush);
562 
563 /*-- asn1-parse.y --*/
564 int ksba_asn_parse_file (const char *filename, ksba_asn_tree_t *result,
565  int debug);
567 
568 /*-- asn1-func.c --*/
569 void ksba_asn_tree_dump (ksba_asn_tree_t tree, const char *name, FILE *fp);
570 gpg_error_t ksba_asn_create_tree (const char *mod_name, ksba_asn_tree_t *result);
571 
572 /*-- oid.c --*/
573 char *ksba_oid_to_str (const char *buffer, size_t length);
574 gpg_error_t ksba_oid_from_str (const char *string,
575  unsigned char **rbuf, size_t *rlength);
576 
577 /*-- dn.c --*/
578 gpg_error_t ksba_dn_der2str (const void *der, size_t derlen, char **r_string);
579 gpg_error_t ksba_dn_str2der (const char *string,
580  unsigned char **rder, size_t *rderlen);
581 gpg_error_t ksba_dn_teststr (const char *string, int seq,
582  size_t *rerroff, size_t *rerrlen);
583 
584 
585 /*-- name.c --*/
586 gpg_error_t ksba_name_new (ksba_name_t *r_name);
589 const char *ksba_name_enum (ksba_name_t name, int idx);
591 
592 
593 /*-- der-builder.c --*/
595 
598 
599 void ksba_der_add_ptr (ksba_der_t d, int cls, int tag,
600  void *value, size_t valuelen);
601 void ksba_der_add_val (ksba_der_t d, int cls, int tag,
602  const void *value, size_t valuelen);
603 void ksba_der_add_int (ksba_der_t d, const void *value, size_t valuelen,
604  int force_positive);
605 void ksba_der_add_oid (ksba_der_t d, const char *oidstr);
606 void ksba_der_add_bts (ksba_der_t d, const void *value, size_t valuelen,
607  unsigned int unusedbits);
608 void ksba_der_add_der (ksba_der_t d, const void *der, size_t derlen);
609 void ksba_der_add_tag (ksba_der_t d, int cls, int tag);
611 
613  unsigned char **r_obj, size_t *r_objlen);
614 
615 
616 
617 /*-- util.c --*/
618 void ksba_set_malloc_hooks ( void *(*new_alloc_func)(size_t n),
619  void *(*new_realloc_func)(void *p, size_t n),
620  void (*new_free_func)(void*) );
621 void ksba_set_hash_buffer_function ( gpg_error_t (*fnc)
622  (void *arg, const char *oid,
623  const void *buffer, size_t length,
624  size_t resultsize,
625  unsigned char *result,
626  size_t *resultlen),
627  void *fnc_arg);
628 void *ksba_malloc (size_t n );
629 void *ksba_calloc (size_t n, size_t m );
630 void *ksba_realloc (void *p, size_t n);
631 char *ksba_strdup (const char *p);
632 void ksba_free ( void *a );
633 
634 /*--version.c --*/
635 const char *ksba_check_version (const char *req_version);
636 
637 #ifdef __cplusplus
638 }
639 #endif
640 #endif /*KSBA_H*/
const char * oid
Definition: cms.c:71
const char * oidstr
Definition: dn.c:57
const char * name
Definition: dn.c:47
const unsigned char * der
Definition: keyinfo.c:367
unsigned int derlen
Definition: keyinfo.c:366
void ksba_set_malloc_hooks(void *(*new_alloc_func)(size_t n), void *(*new_realloc_func)(void *p, size_t n), void(*new_free_func)(void *))
#define _KSBA_DEPRECATED
Definition: ksba.h:68
gpg_error_t ksba_writer_set_fd(ksba_writer_t w, int fd)
ksba_key_usage_t
Definition: ksba.h:197
@ KSBA_KEYUSAGE_CRL_SIGN
Definition: ksba.h:204
@ KSBA_KEYUSAGE_KEY_ENCIPHERMENT
Definition: ksba.h:200
@ KSBA_KEYUSAGE_ENCIPHER_ONLY
Definition: ksba.h:205
@ KSBA_KEYUSAGE_DIGITAL_SIGNATURE
Definition: ksba.h:198
@ KSBA_KEYUSAGE_DATA_ENCIPHERMENT
Definition: ksba.h:201
@ KSBA_KEYUSAGE_NON_REPUDIATION
Definition: ksba.h:199
@ KSBA_KEYUSAGE_KEY_CERT_SIGN
Definition: ksba.h:203
@ KSBA_KEYUSAGE_DECIPHER_ONLY
Definition: ksba.h:206
@ KSBA_KEYUSAGE_KEY_AGREEMENT
Definition: ksba.h:202
gpg_error_t ksba_cms_set_signing_time(ksba_cms_t cms, int idx, const ksba_isotime_t sigtime)
const void * ksba_writer_get_mem(ksba_writer_t w, size_t *nbytes)
gpg_error_t ksba_cms_set_enc_val(ksba_cms_t cms, int idx, ksba_const_sexp_t encval)
gpg_error_t ksba_cms_get_content_enc_iv(ksba_cms_t cms, void *iv, size_t maxivlen, size_t *ivlen)
ksba_sexp_t ksba_cms_get_enc_val(ksba_cms_t cms, int idx)
const char * ksba_cms_get_digest_algo_list(ksba_cms_t cms, int idx)
struct ksba_asn_tree_s * ksba_asn_tree_t
Definition: ksba.h:259
void ksba_der_add_bts(ksba_der_t d, const void *value, size_t valuelen, unsigned int unusedbits)
gpg_error_t ksba_certreq_set_public_key(ksba_certreq_t cr, ksba_const_sexp_t key)
void ksba_name_ref(ksba_name_t name)
void ksba_der_add_tag(ksba_der_t d, int cls, int tag)
gpg_error_t ksba_cert_hash(ksba_cert_t cert, int what, void(*hasher)(void *, const void *, size_t length), void *hasher_arg)
gpg_error_t ksba_cms_parse(ksba_cms_t cms, ksba_stop_reason_t *r_stopreason)
gpg_error_t ksba_writer_set_filter(ksba_writer_t w, gpg_error_t(*filter)(void *, const void *, size_t, size_t *, void *, size_t, size_t *), void *filter_arg)
const char * ksba_crl_get_digest_algo(ksba_crl_t crl)
ksba_der_t ksba_der_builder_new(unsigned int nitems)
struct ksba_der_s * ksba_der_t
Definition: ksba.h:281
void ksba_certreq_set_hash_function(ksba_certreq_t cr, void(*hash_fnc)(void *, const void *, size_t), void *hash_fnc_arg)
struct ksba_reader_s * ksba_reader_t
Definition: ksba.h:247
gpg_error_t ksba_ocsp_set_requestor(ksba_ocsp_t ocsp, ksba_cert_t cert)
const char * ksba_cms_get_content_oid(ksba_cms_t cms, int what)
gpg_error_t ksba_writer_set_mem(ksba_writer_t w, size_t initial_size)
gpg_error_t ksba_writer_new(ksba_writer_t *r_w)
ksba_content_type_t ksba_cms_identify(ksba_reader_t reader)
gpg_error_t ksba_certreq_set_issuer(ksba_certreq_t cr, const char *name)
gpg_error_t ksba_cms_set_message_digest(ksba_cms_t cms, int idx, const unsigned char *digest, size_t digest_len)
void ksba_reader_release(ksba_reader_t r)
void ksba_cms_set_hash_function(ksba_cms_t cms, void(*hash_fnc)(void *, const void *, size_t), void *hash_fnc_arg)
gpg_error_t ksba_ocsp_hash_request(ksba_ocsp_t ocsp, void(*hasher)(void *, const void *, size_t length), void *hasher_arg)
struct ksba_cms_s * ksba_cms_t
Definition: ksba.h:224
void * ksba_malloc(size_t n)
gpg_error_t ksba_crl_get_update_times(ksba_crl_t crl, ksba_isotime_t this_update, ksba_isotime_t next_update)
gpg_error_t ksba_cert_init_from_mem(ksba_cert_t cert, const void *buffer, size_t length)
const char * ksba_cert_get_digest_algo(ksba_cert_t cert)
void ksba_cms_release(ksba_cms_t cms)
gpg_error_t ksba_crl_new(ksba_crl_t *r_crl)
gpg_error_t ksba_certreq_set_sig_val(ksba_certreq_t cr, ksba_const_sexp_t sigval)
gpg_error_t ksba_cert_get_crl_dist_point(ksba_cert_t cert, int idx, ksba_name_t *r_distpoint, ksba_name_t *r_issuer, ksba_crl_reason_t *r_reason)
void ksba_der_add_int(ksba_der_t d, const void *value, size_t valuelen, int force_positive)
gpg_error_t ksba_crl_parse(ksba_crl_t crl, ksba_stop_reason_t *r_stopreason)
void ksba_der_release(ksba_der_t d)
gpg_error_t ksba_certreq_new(ksba_certreq_t *r_cr)
const char * ksba_ocsp_get_digest_algo(ksba_ocsp_t ocsp)
gpg_error_t ksba_writer_set_release_notify(ksba_writer_t w, void(*notify)(void *, ksba_writer_t), void *notify_value)
Definition: writer.c:93
ksba_stop_reason_t
Definition: ksba.h:138
@ KSBA_SR_RUNNING
Definition: ksba.h:140
@ KSBA_SR_BEGIN_ITEMS
Definition: ksba.h:148
@ KSBA_SR_END_DATA
Definition: ksba.h:144
@ KSBA_SR_NONE
Definition: ksba.h:139
@ KSBA_SR_END_ITEMS
Definition: ksba.h:150
@ KSBA_SR_NEED_HASH
Definition: ksba.h:142
@ KSBA_SR_BEGIN_DATA
Definition: ksba.h:143
@ KSBA_SR_GOT_ITEM
Definition: ksba.h:149
@ KSBA_SR_DETACHED_DATA
Definition: ksba.h:147
@ KSBA_SR_NEED_SIG
Definition: ksba.h:146
@ KSBA_SR_GOT_CONTENT
Definition: ksba.h:141
@ KSBA_SR_READY
Definition: ksba.h:145
void ksba_asn_tree_dump(ksba_asn_tree_t tree, const char *name, FILE *fp)
gpg_error_t ksba_oid_from_str(const char *string, unsigned char **rbuf, size_t *rlength)
void ksba_der_add_val(ksba_der_t d, int cls, int tag, const void *value, size_t valuelen)
gpg_error_t ksba_name_new(ksba_name_t *r_name)
struct ksba_crl_s * ksba_crl_t
Definition: ksba.h:230
void ksba_der_add_oid(ksba_der_t d, const char *oidstr)
gpg_error_t ksba_certreq_add_extension(ksba_certreq_t cr, const char *oid, int is_crit, const void *der, size_t derlen)
gpg_error_t ksba_cms_add_signer(ksba_cms_t cms, ksba_cert_t cert)
gpg_error_t ksba_cms_set_sig_val(ksba_cms_t cms, int idx, ksba_const_sexp_t sigval)
char * ksba_name_get_uri(ksba_name_t name, int idx)
gpg_error_t ksba_crl_get_item(ksba_crl_t crl, ksba_sexp_t *r_serial, ksba_isotime_t r_revocation_date, ksba_crl_reason_t *r_reason)
void ksba_cert_ref(ksba_cert_t cert)
gpg_error_t ksba_cms_add_smime_capability(ksba_cms_t cms, const char *oid, const unsigned char *der, size_t derlen)
ksba_crl_reason_t
Definition: ksba.h:156
@ KSBA_CRLREASON_CESSATION_OF_OPERATION
Definition: ksba.h:162
@ KSBA_CRLREASON_REMOVE_FROM_CRL
Definition: ksba.h:164
@ KSBA_CRLREASON_OTHER
Definition: ksba.h:167
@ KSBA_CRLREASON_SUPERSEDED
Definition: ksba.h:161
@ KSBA_CRLREASON_AA_COMPROMISE
Definition: ksba.h:166
@ KSBA_CRLREASON_CA_COMPROMISE
Definition: ksba.h:159
@ KSBA_CRLREASON_PRIVILEGE_WITHDRAWN
Definition: ksba.h:165
@ KSBA_CRLREASON_UNSPECIFIED
Definition: ksba.h:157
@ KSBA_CRLREASON_AFFILIATION_CHANGED
Definition: ksba.h:160
@ KSBA_CRLREASON_KEY_COMPROMISE
Definition: ksba.h:158
@ KSBA_CRLREASON_CERTIFICATE_HOLD
Definition: ksba.h:163
unsigned char * ksba_sexp_t
Definition: ksba.h:273
gpg_error_t ksba_cms_get_signing_time(ksba_cms_t cms, int idx, ksba_isotime_t r_sigtime)
gpg_error_t ksba_reader_set_release_notify(ksba_reader_t r, void(*notify)(void *, ksba_reader_t), void *notify_value)
Definition: reader.c:92
unsigned long ksba_writer_tell(ksba_writer_t w)
gpg_error_t ksba_cms_add_digest_algo(ksba_cms_t cms, const char *oid)
gpg_error_t ksba_crl_get_auth_key_id(ksba_crl_t crl, ksba_sexp_t *r_keyid, ksba_name_t *r_name, ksba_sexp_t *r_serial)
gpg_error_t ksba_cms_get_issuer_serial(ksba_cms_t cms, int idx, char **r_issuer, ksba_sexp_t *r_serial)
gpg_error_t ksba_cert_read_der(ksba_cert_t cert, ksba_reader_t reader)
gpg_error_t ksba_reader_set_file(ksba_reader_t r, FILE *fp)
gpg_error_t ksba_cms_hash_signed_attrs(ksba_cms_t cms, int idx)
gpg_error_t ksba_crl_get_crl_number(ksba_crl_t crl, ksba_sexp_t *number)
gpg_error_t ksba_writer_write(ksba_writer_t w, const void *buffer, size_t length)
int ksba_writer_error(ksba_writer_t w)
void ksba_crl_set_hash_function(ksba_crl_t crl, void(*hash_fnc)(void *, const void *, size_t), void *hash_fnc_arg)
gpg_error_t ksba_reader_unread(ksba_reader_t r, const void *buffer, size_t count)
gpg_error_t ksba_cert_get_authority_info_access(ksba_cert_t cert, int idx, char **r_method, ksba_name_t *r_location)
gpg_error_t ksba_cert_get_ext_key_usages(ksba_cert_t cert, char **result)
gpg_error_t ksba_cert_new(ksba_cert_t *acert)
ksba_content_type_t ksba_cms_get_content_type(ksba_cms_t cms, int what)
gpg_error_t ksba_cms_build(ksba_cms_t cms, ksba_stop_reason_t *r_stopreason)
char ksba_isotime_t[16]
Definition: ksba.h:212
gpg_error_t ksba_ocsp_get_status(ksba_ocsp_t ocsp, ksba_cert_t cert, ksba_status_t *r_status, ksba_isotime_t r_this_update, ksba_isotime_t r_next_update, ksba_isotime_t r_revocation_time, ksba_crl_reason_t *r_reason)
struct ksba_certreq_s * ksba_certreq_t
Definition: ksba.h:241
gpg_error_t ksba_cert_is_ca(ksba_cert_t cert, int *r_ca, int *r_pathlen)
gpg_error_t ksba_cms_add_recipient(ksba_cms_t cms, ksba_cert_t cert)
ksba_ocsp_response_status_t
Definition: ksba.h:173
@ KSBA_OCSP_RSPSTATUS_MALFORMED
Definition: ksba.h:175
@ KSBA_OCSP_RSPSTATUS_REPLAYED
Definition: ksba.h:180
@ KSBA_OCSP_RSPSTATUS_TRYLATER
Definition: ksba.h:177
@ KSBA_OCSP_RSPSTATUS_OTHER
Definition: ksba.h:181
@ KSBA_OCSP_RSPSTATUS_SUCCESS
Definition: ksba.h:174
@ KSBA_OCSP_RSPSTATUS_SIGREQUIRED
Definition: ksba.h:178
@ KSBA_OCSP_RSPSTATUS_UNAUTHORIZED
Definition: ksba.h:179
@ KSBA_OCSP_RSPSTATUS_NONE
Definition: ksba.h:182
@ KSBA_OCSP_RSPSTATUS_INTERNAL
Definition: ksba.h:176
gpg_error_t ksba_der_builder_get(ksba_der_t d, unsigned char **r_obj, size_t *r_objlen)
gpg_error_t ksba_dn_der2str(const void *der, size_t derlen, char **r_string)
gpg_error_t ksba_ocsp_build_request(ksba_ocsp_t ocsp, unsigned char **r_buffer, size_t *r_buflen)
gpg_error_t ksba_cms_add_cert(ksba_cms_t cms, ksba_cert_t cert)
gpg_error_t ksba_reader_set_mem(ksba_reader_t r, const void *buffer, size_t length)
gpg_error_t ksba_cms_set_reader_writer(ksba_cms_t cms, ksba_reader_t r, ksba_writer_t w)
void * ksba_realloc(void *p, size_t n)
void * ksba_calloc(size_t n, size_t m)
char * ksba_oid_to_str(const char *buffer, size_t length)
void ksba_name_release(ksba_name_t name)
gpg_error_t ksba_cms_set_content_enc_algo(ksba_cms_t cms, const char *oid, const void *iv, size_t ivlen)
gpg_error_t ksba_cert_get_subject_info_access(ksba_cert_t cert, int idx, char **r_method, ksba_name_t *r_location)
gpg_error_t ksba_certreq_build(ksba_certreq_t cr, ksba_stop_reason_t *r_stopreason)
ksba_cert_t ksba_ocsp_get_cert(ksba_ocsp_t ocsp, int idx)
gpg_error_t ksba_cms_set_content_type(ksba_cms_t cms, int what, ksba_content_type_t type)
gpg_error_t ksba_ocsp_add_target(ksba_ocsp_t ocsp, ksba_cert_t cert, ksba_cert_t issuer_cert)
gpg_error_t ksba_certreq_set_writer(ksba_certreq_t cr, ksba_writer_t w)
gpg_error_t ksba_cert_set_user_data(ksba_cert_t cert, const char *key, const void *data, size_t datalen)
gpg_error_t ksba_cert_get_extension(ksba_cert_t cert, int idx, char const **r_oid, int *r_crit, size_t *r_deroff, size_t *r_derlen)
gpg_error_t ksba_certreq_add_subject(ksba_certreq_t cr, const char *name)
const char * ksba_cms_get_digest_algo(ksba_cms_t cms, int idx)
gpg_error_t ksba_cms_get_sigattr_oids(ksba_cms_t cms, int idx, const char *reqoid, char **r_value)
unsigned long ksba_reader_tell(ksba_reader_t r)
gpg_error_t ksba_ocsp_hash_response(ksba_ocsp_t ocsp, const unsigned char *msg, size_t msglen, void(*hasher)(void *, const void *, size_t length), void *hasher_arg)
struct ksba_cert_s * ksba_cert_t
Definition: ksba.h:218
gpg_error_t ksba_reader_set_fd(ksba_reader_t r, int fd)
gpg_error_t ksba_ocsp_add_cert(ksba_ocsp_t ocsp, ksba_cert_t cert)
gpg_error_t ksba_ocsp_get_extension(ksba_ocsp_t ocsp, ksba_cert_t cert, int idx, char const **r_oid, int *r_crit, unsigned char const **r_der, size_t *r_derlen)
ksba_cert_t ksba_cms_get_cert(ksba_cms_t cms, int idx)
gpg_error_t ksba_crl_get_extension(ksba_crl_t crl, int idx, char const **oid, int *critical, unsigned char const **der, size_t *derlen)
void ksba_der_add_end(ksba_der_t d)
gpg_error_t ksba_dn_teststr(const char *string, int seq, size_t *rerroff, size_t *rerrlen)
gpg_error_t ksba_writer_set_file(ksba_writer_t w, FILE *fp)
ksba_sexp_t ksba_ocsp_get_sig_val(ksba_ocsp_t ocsp, ksba_isotime_t produced_at)
struct ksba_writer_s * ksba_writer_t
Definition: ksba.h:253
gpg_error_t ksba_cert_get_subj_key_id(ksba_cert_t cert, int *r_crit, ksba_sexp_t *r_keyid)
struct ksba_name_s * ksba_name_t
Definition: ksba.h:265
const unsigned char * ksba_cert_get_image(ksba_cert_t cert, size_t *r_length)
const char * ksba_check_version(const char *req_version)
gpg_error_t ksba_reader_clear(ksba_reader_t r, unsigned char **buffer, size_t *buflen)
void ksba_writer_release(ksba_writer_t w)
ksba_content_type_t
Definition: ksba.h:119
@ KSBA_CT_DATA
Definition: ksba.h:121
@ KSBA_CT_DIGESTED_DATA
Definition: ksba.h:124
@ KSBA_CT_AUTH_DATA
Definition: ksba.h:126
@ KSBA_CT_PKCS12
Definition: ksba.h:127
@ KSBA_CT_SPC_IND_DATA_CTX
Definition: ksba.h:128
@ KSBA_CT_SIGNED_DATA
Definition: ksba.h:122
@ KSBA_CT_ENVELOPED_DATA
Definition: ksba.h:123
@ KSBA_CT_AUTHENVELOPED_DATA
Definition: ksba.h:130
@ KSBA_CT_ENCRYPTED_DATA
Definition: ksba.h:125
@ KSBA_CT_OPENPGP_KEYBLOCK
Definition: ksba.h:129
@ KSBA_CT_NONE
Definition: ksba.h:120
void ksba_ocsp_release(ksba_ocsp_t ocsp)
gpg_error_t ksba_reader_read(ksba_reader_t r, char *buffer, size_t length, size_t *nread)
size_t ksba_ocsp_set_nonce(ksba_ocsp_t ocsp, unsigned char *nonce, size_t noncelen)
void ksba_der_builder_reset(ksba_der_t d)
gpg_error_t ksba_certreq_set_siginfo(ksba_certreq_t cr, ksba_const_sexp_t siginfo)
gpg_error_t ksba_asn_create_tree(const char *mod_name, ksba_asn_tree_t *result)
gpg_error_t ksba_cert_get_cert_policies(ksba_cert_t cert, char **r_policies)
gpg_error_t ksba_crl_set_reader(ksba_crl_t crl, ksba_reader_t r)
gpg_error_t ksba_cms_get_message_digest(ksba_cms_t cms, int idx, char **r_digest, size_t *r_digest_len)
const unsigned char * ksba_const_sexp_t
Definition: ksba.h:275
void ksba_certreq_release(ksba_certreq_t cr)
int ksba_asn_parse_file(const char *filename, ksba_asn_tree_t *result, int debug)
gpg_error_t ksba_certreq_set_validity(ksba_certreq_t cr, int what, const ksba_isotime_t timebuf)
gpg_error_t ksba_certreq_set_serial(ksba_certreq_t cr, ksba_const_sexp_t sn)
gpg_error_t ksba_cert_get_user_data(ksba_cert_t cert, const char *key, void *buffer, size_t bufferlen, size_t *datalen)
ksba_status_t
Definition: ksba.h:187
@ KSBA_STATUS_REVOKED
Definition: ksba.h:191
@ KSBA_STATUS_GOOD
Definition: ksba.h:190
@ KSBA_STATUS_NONE
Definition: ksba.h:188
@ KSBA_STATUS_UNKNOWN
Definition: ksba.h:189
gpg_error_t ksba_reader_error(ksba_reader_t r)
gpg_error_t ksba_ocsp_set_sig_val(ksba_ocsp_t ocsp, ksba_const_sexp_t sigval)
gpg_error_t ksba_ocsp_parse_response(ksba_ocsp_t ocsp, const unsigned char *msg, size_t msglen, ksba_ocsp_response_status_t *resp_status)
void * ksba_writer_snatch_mem(ksba_writer_t w, size_t *nbytes)
gpg_error_t KsbaError
Definition: ksba.h:116
ksba_sexp_t ksba_crl_get_sig_val(ksba_crl_t crl)
unsigned char * KsbaSexp
Definition: ksba.h:274
gpg_error_t ksba_cert_get_auth_key_id(ksba_cert_t cert, ksba_sexp_t *r_keyid, ksba_name_t *r_name, ksba_sexp_t *r_serial)
void ksba_free(void *a)
void ksba_crl_release(ksba_crl_t crl)
void ksba_cert_release(ksba_cert_t cert)
void ksba_der_add_ptr(ksba_der_t d, int cls, int tag, void *value, size_t valuelen)
gpg_error_t ksba_ocsp_get_responder_id(ksba_ocsp_t ocsp, char **r_name, ksba_sexp_t *r_keyid)
gpg_error_t ksba_cert_get_validity(ksba_cert_t cert, int what, ksba_isotime_t r_time)
ksba_sexp_t ksba_cert_get_sig_val(ksba_cert_t cert)
gpg_error_t ksba_dn_str2der(const char *string, unsigned char **rder, size_t *rderlen)
void ksba_asn_tree_release(ksba_asn_tree_t tree)
char * ksba_cert_get_issuer(ksba_cert_t cert, int idx)
char * ksba_strdup(const char *p)
struct ksba_ocsp_s * ksba_ocsp_t
Definition: ksba.h:236
gpg_error_t ksba_ocsp_prepare_request(ksba_ocsp_t ocsp)
ksba_sexp_t ksba_cms_get_sig_val(ksba_cms_t cms, int idx)
gpg_error_t ksba_crl_get_issuer(ksba_crl_t crl, char **r_issuer)
gpg_error_t ksba_cms_new(ksba_cms_t *r_cms)
char * ksba_cert_get_subject(ksba_cert_t cert, int idx)
gpg_error_t ksba_writer_set_cb(ksba_writer_t w, int(*cb)(void *, const void *, size_t), void *cb_value)
gpg_error_t ksba_cert_get_key_usage(ksba_cert_t cert, unsigned int *r_flags)
const char * ksba_name_enum(ksba_name_t name, int idx)
gpg_error_t ksba_ocsp_set_digest_algo(ksba_ocsp_t ocsp, const char *oid)
ksba_sexp_t ksba_cert_get_public_key(ksba_cert_t cert)
void ksba_der_add_der(ksba_der_t d, const void *der, size_t derlen)
gpg_error_t ksba_ocsp_new(ksba_ocsp_t *r_oscp)
gpg_error_t ksba_reader_new(ksba_reader_t *r_r)
const unsigned char * KsbaConstSexp
Definition: ksba.h:276
gpg_error_t ksba_reader_set_cb(ksba_reader_t r, int(*cb)(void *, char *, size_t, size_t *), void *cb_value)
void ksba_set_hash_buffer_function(gpg_error_t(*fnc)(void *arg, const char *oid, const void *buffer, size_t length, size_t resultsize, unsigned char *result, size_t *resultlen), void *fnc_arg)
gpg_error_t ksba_writer_write_octet_string(ksba_writer_t w, const void *buffer, size_t length, int flush)
ksba_sexp_t ksba_cert_get_serial(ksba_cert_t cert)
Definition: crl.h:51
size_t nitems
Definition: der-builder.c:64