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)  

cms.h
Go to the documentation of this file.
1 /* cms.h - Internal definitions for the CMS functions
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 CMS_H
32 #define CMS_H 1
33 
34 #include "ksba.h"
35 
36 #ifndef HAVE_TYPEDEFD_ASNNODE
37 typedef struct asn_node_struct *AsnNode; /* FIXME: should not go here */
38 #define HAVE_TYPEDEFD_ASNNODE
39 #endif
40 
41 
42 /* This structure is used to store the results of a BER parser run. */
43 struct value_tree_s {
44  struct value_tree_s *next;
45  AsnNode root; /* root of the tree with the values */
46  unsigned char *image;
47  size_t imagelen;
48 };
49 
50 
51 struct enc_val_s {
52  char *algo;
53  unsigned char *value; /* RSA's "a" or ECDH's "s". (malloced) */
54  size_t valuelen;
55  struct {
56  unsigned char *e; /* Malloced buffer. */
57  size_t elen; /* Length of E. */
58  char *encr_algo; /* Malloced OID string. */
59  char *wrap_algo; /* Malloced OID string. */
60  } ecdh;
61 };
62 
63 
64 struct oidlist_s {
65  struct oidlist_s *next;
66  char *oid;
67 };
68 
69 /* A structure to store an OID and a parameter. */
70 struct oidparmlist_s {
72  char *oid;
73  size_t parmlen;
74  unsigned char parm[1];
75 };
76 
77 
78 struct certlist_s {
79  struct certlist_s *next;
81  int msg_digest_len; /* used length of .. */
82  char msg_digest[64]; /* enough space to store a SHA-512 hash */
84  struct {
86  unsigned char *image;
87  } sa;
88  struct enc_val_s enc_val; /* used for creating enveloped data */
89 };
90 
91 
92 struct signer_info_s {
94  AsnNode root; /* root of the tree with the values */
95  unsigned char *image;
96  size_t imagelen;
97  struct {
98  char *digest_algo;
99  } cache;
100 };
101 
102 struct sig_val_s {
103  struct sig_val_s *next;
104  char *algo;
105  unsigned char *value; /* Malloced buffer for parameter "s". */
106  size_t valuelen; /* Used length of VALUE. */
107  struct {
108  unsigned char *r; /* Malloced buffer for parameter "r". */
109  size_t rlen; /* Length of R. */
110  } ecc;
111 };
112 
113 
114 struct ksba_cms_s {
115  gpg_error_t last_error;
116 
119 
120  void (*hash_fnc)(void *, const void *, size_t);
122 
124 
125  struct {
126  char *oid;
127  unsigned long length;
128  int ndef;
130  gpg_error_t (*handler)(ksba_cms_t);
132 
133  /* Data used with auth enveloped data. */
134  struct {
135  unsigned char *mac; /* The MAC (authtag) */
136  int mac_len;
137  unsigned char *attr; /* DER encoded authAttr. */
138  int attr_len;
140 
142 
145  char *inner_cont_oid; /* Encapsulated or Encrypted
146  ContentInfo.contentType as string */
147  unsigned long inner_cont_len;
149  int detached_data; /* no actual data */
151  char *encr_iv;
152  size_t encr_ivlen;
153 
154  struct certlist_s *cert_info_list; /* A list with certificates intended
155  to be send with a signed message */
156 
157  struct oidparmlist_s *capability_list; /* A list of S/MIME capabilities. */
158 
160 
162 
164 
166 };
167 
168 
169 /*-- cms.c --*/
170 
171 
172 /*-- cms-parser.c --*/
173 gpg_error_t _ksba_cms_parse_content_info (ksba_cms_t cms);
178 
179 
180 
181 #endif /*CMS_H*/
gpg_error_t _ksba_cms_parse_content_info(ksba_cms_t cms)
Definition: cms-parser.c:402
gpg_error_t _ksba_cms_parse_signed_data_part_2(ksba_cms_t cms)
Definition: cms-parser.c:617
gpg_error_t _ksba_cms_parse_signed_data_part_1(ksba_cms_t cms)
Definition: cms-parser.c:509
struct asn_node_struct * AsnNode
Definition: cms.h:37
gpg_error_t _ksba_cms_parse_enveloped_data_part_1(ksba_cms_t cms)
Definition: cms-parser.c:841
gpg_error_t _ksba_cms_parse_enveloped_data_part_2(ksba_cms_t cms)
Definition: cms-parser.c:1025
struct ksba_cms_s * ksba_cms_t
Definition: ksba.h:224
ksba_stop_reason_t
Definition: ksba.h:138
char ksba_isotime_t[16]
Definition: ksba.h:212
ksba_content_type_t
Definition: ksba.h:119
Definition: cms.h:78
AsnNode root
Definition: cms.h:85
struct certlist_s * next
Definition: cms.h:79
struct enc_val_s enc_val
Definition: cms.h:88
ksba_isotime_t signing_time
Definition: cms.h:83
unsigned char * image
Definition: cms.h:86
char msg_digest[64]
Definition: cms.h:82
struct certlist_s::@16 sa
ksba_cert_t cert
Definition: cms.h:80
int msg_digest_len
Definition: cms.h:81
Definition: cms.h:51
struct enc_val_s::@15 ecdh
unsigned char * e
Definition: cms.h:56
unsigned char * value
Definition: cms.h:53
size_t elen
Definition: cms.h:57
char * wrap_algo
Definition: cms.h:59
size_t valuelen
Definition: cms.h:54
char * encr_algo
Definition: cms.h:58
char * algo
Definition: cms.h:52
int mac_len
Definition: cms.h:136
struct certlist_s * cert_info_list
Definition: cms.h:154
struct oidparmlist_s * capability_list
Definition: cms.h:157
struct ksba_cms_s::@19 content
int cms_version
Definition: cms.h:141
unsigned char * attr
Definition: cms.h:137
void(* hash_fnc)(void *, const void *, size_t)
Definition: cms.h:120
struct enc_val_s * enc_val
Definition: cms.h:165
char * oid
Definition: cms.h:126
gpg_error_t(* handler)(ksba_cms_t)
Definition: cms.h:130
void * hash_fnc_arg
Definition: cms.h:121
struct signer_info_s * signer_info
Definition: cms.h:159
char * encr_iv
Definition: cms.h:151
unsigned long length
Definition: cms.h:127
struct certlist_s * cert_list
Definition: cms.h:144
struct ksba_cms_s::@20 authdata
int inner_cont_ndef
Definition: cms.h:148
unsigned char * mac
Definition: cms.h:135
struct sig_val_s * sig_val
Definition: cms.h:163
char * encr_algo_oid
Definition: cms.h:150
unsigned long inner_cont_len
Definition: cms.h:147
int detached_data
Definition: cms.h:149
ksba_stop_reason_t stop_reason
Definition: cms.h:123
struct value_tree_s * recp_info
Definition: cms.h:161
struct oidlist_s * digest_algos
Definition: cms.h:143
size_t encr_ivlen
Definition: cms.h:152
ksba_writer_t writer
Definition: cms.h:118
ksba_content_type_t ct
Definition: cms.h:129
int ndef
Definition: cms.h:128
ksba_reader_t reader
Definition: cms.h:117
int attr_len
Definition: cms.h:138
char * inner_cont_oid
Definition: cms.h:145
gpg_error_t last_error
Definition: cms.h:115
Definition: cms.h:64
struct oidlist_s * next
Definition: cms.h:65
char * oid
Definition: cms.h:66
char * oid
Definition: cms.h:72
struct oidparmlist_s * next
Definition: cms.h:71
size_t parmlen
Definition: cms.h:73
unsigned char parm[1]
Definition: cms.h:74
Definition: cms.h:102
char * algo
Definition: cms.h:104
struct sig_val_s::@18 ecc
unsigned char * r
Definition: cms.h:108
size_t valuelen
Definition: cms.h:106
size_t rlen
Definition: cms.h:109
struct sig_val_s * next
Definition: cms.h:103
unsigned char * value
Definition: cms.h:105
unsigned char * image
Definition: cms.h:95
char * digest_algo
Definition: cms.h:98
size_t imagelen
Definition: cms.h:96
struct signer_info_s * next
Definition: cms.h:93
struct signer_info_s::@17 cache
AsnNode root
Definition: cms.h:94
size_t imagelen
Definition: cms.h:47
struct value_tree_s * next
Definition: cms.h:44
unsigned char * image
Definition: cms.h:46
AsnNode root
Definition: cms.h:45