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)  

cert.h
Go to the documentation of this file.
1 /* cert.h - Internal definitions for cert.c
2  * Copyright (C) 2001, 2012 g10 Code GmbH
3  *
4  * This file is part of KSBA.
5  *
6  * KSBA is free software; you can redistribute it and/or modify
7  * it under the terms of either
8  *
9  * - the GNU Lesser General Public License as published by the Free
10  * Software Foundation; either version 3 of the License, or (at
11  * your option) any later version.
12  *
13  * or
14  *
15  * - the GNU General Public License as published by the Free
16  * Software Foundation; either version 2 of the License, or (at
17  * your option) any later version.
18  *
19  * or both in parallel, as here.
20  *
21  * KSBA is distributed in the hope that it will be useful, but WITHOUT
22  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
24  * License for more details.
25  *
26  * You should have received a copies of the GNU General Public License
27  * and the GNU Lesser General Public License along with this program;
28  * if not, see <http://www.gnu.org/licenses/>.
29  */
30 
31 #ifndef CERT_H
32 #define CERT_H 1
33 
34 #include "asn1-func.h"
35 
36 /* An object to keep parsed information about an extension. */
38 {
39  char *oid;
40  int crit;
41  int off, len;
42 };
43 
44 
45 /* An object to store user supplied data to be associated with a
46  certificates. This is implemented as a linked list with the
47  constrained that a given key may only occur once. */
49 {
50  struct cert_user_data *next; /* Link to next item. */
51 
52  /* The length of the data store at DATA. */
53  size_t datalen;
54 
55  /* The stored data. This is either malloced storage or points to
56  DATABUF below. If it is NULL, no data is actually stored under
57  the key. */
58  void *data;
59 
60  /* Often we need to store only a few bytes as data. By providing a
61  fixed buffer we are able to avoid an extra malloc in this case. */
62  char databuf[sizeof (int)];
63 
64  /* The key used to store the data object. Dynamically allocated at
65  object creation time. */
66  char key[1];
67 };
68 
69 
70 /* The internal certificate object. */
72 {
73  /* Certificate objects often play a central role and applications
74  might want to associate other data with the certificate to avoid
75  wrapping the certificate object into an own object. This UDATA
76  linked list provides the means to do that. It gets accessed by
77  ksba_cert_set_user_data and ksba_cert_get_user_data. */
79 
80  /* This object has been initialized with an actual certificate.
81  Note that UDATA may be used even without an initialized
82  certificate. */
84 
85  /* Because we often need to pass certificate objects to other
86  functions, we use reference counting to keep resource overhead
87  low. Note, that this object usually gets only read and not
88  modified. */
89  int ref_count;
90 
92  AsnNode root; /* Root of the tree with the values */
93 
94  unsigned char *image;
95  size_t imagelen;
96 
97  gpg_error_t last_error;
98  struct {
99  char *digest_algo;
101  int n_extns;
103  } cache;
104 };
105 
106 
107 /*** Internal functions ***/
108 
110 
111 gpg_error_t _ksba_cert_get_serial_ptr (ksba_cert_t cert,
112  unsigned char const **ptr,
113  size_t *length);
114 gpg_error_t _ksba_cert_get_issuer_dn_ptr (ksba_cert_t cert,
115  unsigned char const **ptr,
116  size_t *length);
118  unsigned char const **ptr,
119  size_t *length);
121  unsigned char const **ptr,
122  size_t *length);
123 
124 
125 #endif /*CERT_H*/
int _ksba_cert_cmp(ksba_cert_t a, ksba_cert_t b)
Definition: cert.c:376
gpg_error_t _ksba_cert_get_subject_dn_ptr(ksba_cert_t cert, unsigned char const **ptr, size_t *length)
Definition: cert.c:583
gpg_error_t _ksba_cert_get_public_key_ptr(ksba_cert_t cert, unsigned char const **ptr, size_t *length)
Definition: cert.c:882
gpg_error_t _ksba_cert_get_issuer_dn_ptr(ksba_cert_t cert, unsigned char const **ptr, size_t *length)
Definition: cert.c:559
gpg_error_t _ksba_cert_get_serial_ptr(ksba_cert_t cert, unsigned char const **ptr, size_t *length)
Definition: cert.c:537
char * oid
Definition: cert.h:39
int off
Definition: cert.h:41
int len
Definition: cert.h:41
int crit
Definition: cert.h:40
char key[1]
Definition: cert.h:66
void * data
Definition: cert.h:58
size_t datalen
Definition: cert.h:53
struct cert_user_data * next
Definition: cert.h:50
char databuf[sizeof(int)]
Definition: cert.h:62
AsnNode root
Definition: cert.h:92
gpg_error_t last_error
Definition: cert.h:97
struct cert_user_data * udata
Definition: cert.h:78
size_t imagelen
Definition: cert.h:95
int initialized
Definition: cert.h:83
int n_extns
Definition: cert.h:101
int extns_valid
Definition: cert.h:100
unsigned char * image
Definition: cert.h:94
struct ksba_cert_s::@5 cache
int ref_count
Definition: cert.h:89
ksba_asn_tree_t asn_tree
Definition: cert.h:91
char * digest_algo
Definition: cert.h:99
struct cert_extn_info * extns
Definition: cert.h:102