williamr@2
|
1 |
/* crypto/pkcs7/pkcs7.h */
|
williamr@2
|
2 |
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
*
|
williamr@2
|
5 |
* This package is an SSL implementation written
|
williamr@2
|
6 |
* by Eric Young (eay@cryptsoft.com).
|
williamr@2
|
7 |
* The implementation was written so as to conform with Netscapes SSL.
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* This library is free for commercial and non-commercial use as long as
|
williamr@2
|
10 |
* the following conditions are aheared to. The following conditions
|
williamr@2
|
11 |
* apply to all code found in this distribution, be it the RC4, RSA,
|
williamr@2
|
12 |
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
williamr@2
|
13 |
* included with this distribution is covered by the same copyright terms
|
williamr@2
|
14 |
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
williamr@2
|
15 |
*
|
williamr@2
|
16 |
* Copyright remains Eric Young's, and as such any Copyright notices in
|
williamr@2
|
17 |
* the code are not to be removed.
|
williamr@2
|
18 |
* If this package is used in a product, Eric Young should be given attribution
|
williamr@2
|
19 |
* as the author of the parts of the library used.
|
williamr@2
|
20 |
* This can be in the form of a textual message at program startup or
|
williamr@2
|
21 |
* in documentation (online or textual) provided with the package.
|
williamr@2
|
22 |
*
|
williamr@2
|
23 |
* Redistribution and use in source and binary forms, with or without
|
williamr@2
|
24 |
* modification, are permitted provided that the following conditions
|
williamr@2
|
25 |
* are met:
|
williamr@2
|
26 |
* 1. Redistributions of source code must retain the copyright
|
williamr@2
|
27 |
* notice, this list of conditions and the following disclaimer.
|
williamr@2
|
28 |
* 2. Redistributions in binary form must reproduce the above copyright
|
williamr@2
|
29 |
* notice, this list of conditions and the following disclaimer in the
|
williamr@2
|
30 |
* documentation and/or other materials provided with the distribution.
|
williamr@2
|
31 |
* 3. All advertising materials mentioning features or use of this software
|
williamr@2
|
32 |
* must display the following acknowledgement:
|
williamr@2
|
33 |
* "This product includes cryptographic software written by
|
williamr@2
|
34 |
* Eric Young (eay@cryptsoft.com)"
|
williamr@2
|
35 |
* The word 'cryptographic' can be left out if the rouines from the library
|
williamr@2
|
36 |
* being used are not cryptographic related :-).
|
williamr@2
|
37 |
* 4. If you include any Windows specific code (or a derivative thereof) from
|
williamr@2
|
38 |
* the apps directory (application code) you must include an acknowledgement:
|
williamr@2
|
39 |
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
williamr@2
|
40 |
*
|
williamr@2
|
41 |
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
williamr@2
|
42 |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
williamr@2
|
43 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
williamr@2
|
44 |
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
williamr@2
|
45 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
williamr@2
|
46 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
williamr@2
|
47 |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
williamr@2
|
48 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
williamr@2
|
49 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
williamr@2
|
50 |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
williamr@2
|
51 |
* SUCH DAMAGE.
|
williamr@2
|
52 |
*
|
williamr@2
|
53 |
* The licence and distribution terms for any publically available version or
|
williamr@2
|
54 |
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
williamr@2
|
55 |
* copied and put under another distribution licence
|
williamr@2
|
56 |
* [including the GNU Public Licence.]
|
williamr@2
|
57 |
*/
|
williamr@2
|
58 |
/*
|
williamr@2
|
59 |
© Portions copyright (c) 2006 Nokia Corporation. All rights reserved.
|
williamr@2
|
60 |
*/
|
williamr@2
|
61 |
|
williamr@2
|
62 |
#ifndef HEADER_PKCS7_H
|
williamr@2
|
63 |
#define HEADER_PKCS7_H
|
williamr@2
|
64 |
|
williamr@2
|
65 |
#if (defined(__SYMBIAN32__) && !defined(SYMBIAN))
|
williamr@2
|
66 |
#define SYMBIAN
|
williamr@2
|
67 |
#endif
|
williamr@2
|
68 |
|
williamr@2
|
69 |
#ifdef SYMBIAN
|
williamr@2
|
70 |
#include <e32def.h>
|
williamr@2
|
71 |
#endif
|
williamr@2
|
72 |
#include <openssl/asn1.h>
|
williamr@2
|
73 |
#include <openssl/bio.h>
|
williamr@2
|
74 |
#include <openssl/e_os2.h>
|
williamr@2
|
75 |
|
williamr@2
|
76 |
#include <openssl/symhacks.h>
|
williamr@2
|
77 |
#include <openssl/ossl_typ.h>
|
williamr@2
|
78 |
|
williamr@2
|
79 |
#ifdef __cplusplus
|
williamr@2
|
80 |
extern "C" {
|
williamr@2
|
81 |
#endif
|
williamr@2
|
82 |
|
williamr@2
|
83 |
#ifdef OPENSSL_SYS_WIN32
|
williamr@2
|
84 |
/* Under Win32 thes are defined in wincrypt.h */
|
williamr@2
|
85 |
#undef PKCS7_ISSUER_AND_SERIAL
|
williamr@2
|
86 |
#undef PKCS7_SIGNER_INFO
|
williamr@2
|
87 |
#endif
|
williamr@2
|
88 |
|
williamr@2
|
89 |
/*
|
williamr@2
|
90 |
Encryption_ID DES-CBC
|
williamr@2
|
91 |
Digest_ID MD5
|
williamr@2
|
92 |
Digest_Encryption_ID rsaEncryption
|
williamr@2
|
93 |
Key_Encryption_ID rsaEncryption
|
williamr@2
|
94 |
*/
|
williamr@2
|
95 |
|
williamr@2
|
96 |
typedef struct pkcs7_issuer_and_serial_st
|
williamr@2
|
97 |
{
|
williamr@2
|
98 |
X509_NAME *issuer;
|
williamr@2
|
99 |
ASN1_INTEGER *serial;
|
williamr@2
|
100 |
} PKCS7_ISSUER_AND_SERIAL;
|
williamr@2
|
101 |
|
williamr@2
|
102 |
typedef struct pkcs7_signer_info_st
|
williamr@2
|
103 |
{
|
williamr@2
|
104 |
ASN1_INTEGER *version; /* version 1 */
|
williamr@2
|
105 |
PKCS7_ISSUER_AND_SERIAL *issuer_and_serial;
|
williamr@2
|
106 |
X509_ALGOR *digest_alg;
|
williamr@2
|
107 |
STACK_OF(X509_ATTRIBUTE) *auth_attr; /* [ 0 ] */
|
williamr@2
|
108 |
X509_ALGOR *digest_enc_alg;
|
williamr@2
|
109 |
ASN1_OCTET_STRING *enc_digest;
|
williamr@2
|
110 |
STACK_OF(X509_ATTRIBUTE) *unauth_attr; /* [ 1 ] */
|
williamr@2
|
111 |
|
williamr@2
|
112 |
/* The private key to sign with */
|
williamr@2
|
113 |
EVP_PKEY *pkey;
|
williamr@2
|
114 |
} PKCS7_SIGNER_INFO;
|
williamr@2
|
115 |
|
williamr@2
|
116 |
DECLARE_STACK_OF(PKCS7_SIGNER_INFO)
|
williamr@2
|
117 |
DECLARE_ASN1_SET_OF(PKCS7_SIGNER_INFO)
|
williamr@2
|
118 |
|
williamr@2
|
119 |
typedef struct pkcs7_recip_info_st
|
williamr@2
|
120 |
{
|
williamr@2
|
121 |
ASN1_INTEGER *version; /* version 0 */
|
williamr@2
|
122 |
PKCS7_ISSUER_AND_SERIAL *issuer_and_serial;
|
williamr@2
|
123 |
X509_ALGOR *key_enc_algor;
|
williamr@2
|
124 |
ASN1_OCTET_STRING *enc_key;
|
williamr@2
|
125 |
X509 *cert; /* get the pub-key from this */
|
williamr@2
|
126 |
} PKCS7_RECIP_INFO;
|
williamr@2
|
127 |
|
williamr@2
|
128 |
DECLARE_STACK_OF(PKCS7_RECIP_INFO)
|
williamr@2
|
129 |
DECLARE_ASN1_SET_OF(PKCS7_RECIP_INFO)
|
williamr@2
|
130 |
|
williamr@2
|
131 |
typedef struct pkcs7_signed_st
|
williamr@2
|
132 |
{
|
williamr@2
|
133 |
ASN1_INTEGER *version; /* version 1 */
|
williamr@2
|
134 |
STACK_OF(X509_ALGOR) *md_algs; /* md used */
|
williamr@2
|
135 |
STACK_OF(X509) *cert; /* [ 0 ] */
|
williamr@2
|
136 |
STACK_OF(X509_CRL) *crl; /* [ 1 ] */
|
williamr@2
|
137 |
STACK_OF(PKCS7_SIGNER_INFO) *signer_info;
|
williamr@2
|
138 |
|
williamr@2
|
139 |
struct pkcs7_st *contents;
|
williamr@2
|
140 |
} PKCS7_SIGNED;
|
williamr@2
|
141 |
/* The above structure is very very similar to PKCS7_SIGN_ENVELOPE.
|
williamr@2
|
142 |
* How about merging the two */
|
williamr@2
|
143 |
|
williamr@2
|
144 |
typedef struct pkcs7_enc_content_st
|
williamr@2
|
145 |
{
|
williamr@2
|
146 |
ASN1_OBJECT *content_type;
|
williamr@2
|
147 |
X509_ALGOR *algorithm;
|
williamr@2
|
148 |
ASN1_OCTET_STRING *enc_data; /* [ 0 ] */
|
williamr@2
|
149 |
const EVP_CIPHER *cipher;
|
williamr@2
|
150 |
} PKCS7_ENC_CONTENT;
|
williamr@2
|
151 |
|
williamr@2
|
152 |
typedef struct pkcs7_enveloped_st
|
williamr@2
|
153 |
{
|
williamr@2
|
154 |
ASN1_INTEGER *version; /* version 0 */
|
williamr@2
|
155 |
STACK_OF(PKCS7_RECIP_INFO) *recipientinfo;
|
williamr@2
|
156 |
PKCS7_ENC_CONTENT *enc_data;
|
williamr@2
|
157 |
} PKCS7_ENVELOPE;
|
williamr@2
|
158 |
|
williamr@2
|
159 |
typedef struct pkcs7_signedandenveloped_st
|
williamr@2
|
160 |
{
|
williamr@2
|
161 |
ASN1_INTEGER *version; /* version 1 */
|
williamr@2
|
162 |
STACK_OF(X509_ALGOR) *md_algs; /* md used */
|
williamr@2
|
163 |
STACK_OF(X509) *cert; /* [ 0 ] */
|
williamr@2
|
164 |
STACK_OF(X509_CRL) *crl; /* [ 1 ] */
|
williamr@2
|
165 |
STACK_OF(PKCS7_SIGNER_INFO) *signer_info;
|
williamr@2
|
166 |
|
williamr@2
|
167 |
PKCS7_ENC_CONTENT *enc_data;
|
williamr@2
|
168 |
STACK_OF(PKCS7_RECIP_INFO) *recipientinfo;
|
williamr@2
|
169 |
} PKCS7_SIGN_ENVELOPE;
|
williamr@2
|
170 |
|
williamr@2
|
171 |
typedef struct pkcs7_digest_st
|
williamr@2
|
172 |
{
|
williamr@2
|
173 |
ASN1_INTEGER *version; /* version 0 */
|
williamr@2
|
174 |
X509_ALGOR *md; /* md used */
|
williamr@2
|
175 |
struct pkcs7_st *contents;
|
williamr@2
|
176 |
ASN1_OCTET_STRING *digest;
|
williamr@2
|
177 |
} PKCS7_DIGEST;
|
williamr@2
|
178 |
|
williamr@2
|
179 |
typedef struct pkcs7_encrypted_st
|
williamr@2
|
180 |
{
|
williamr@2
|
181 |
ASN1_INTEGER *version; /* version 0 */
|
williamr@2
|
182 |
PKCS7_ENC_CONTENT *enc_data;
|
williamr@2
|
183 |
} PKCS7_ENCRYPT;
|
williamr@2
|
184 |
|
williamr@2
|
185 |
typedef struct pkcs7_st
|
williamr@2
|
186 |
{
|
williamr@2
|
187 |
/* The following is non NULL if it contains ASN1 encoding of
|
williamr@2
|
188 |
* this structure */
|
williamr@2
|
189 |
unsigned char *asn1;
|
williamr@2
|
190 |
long length;
|
williamr@2
|
191 |
|
williamr@2
|
192 |
#define PKCS7_S_HEADER 0
|
williamr@2
|
193 |
#define PKCS7_S_BODY 1
|
williamr@2
|
194 |
#define PKCS7_S_TAIL 2
|
williamr@2
|
195 |
int state; /* used during processing */
|
williamr@2
|
196 |
|
williamr@2
|
197 |
int detached;
|
williamr@2
|
198 |
|
williamr@2
|
199 |
ASN1_OBJECT *type;
|
williamr@2
|
200 |
/* content as defined by the type */
|
williamr@2
|
201 |
/* all encryption/message digests are applied to the 'contents',
|
williamr@2
|
202 |
* leaving out the 'type' field. */
|
williamr@2
|
203 |
union {
|
williamr@2
|
204 |
char *ptr;
|
williamr@2
|
205 |
|
williamr@2
|
206 |
/* NID_pkcs7_data */
|
williamr@2
|
207 |
ASN1_OCTET_STRING *data;
|
williamr@2
|
208 |
|
williamr@2
|
209 |
/* NID_pkcs7_signed */
|
williamr@2
|
210 |
PKCS7_SIGNED *sign;
|
williamr@2
|
211 |
|
williamr@2
|
212 |
/* NID_pkcs7_enveloped */
|
williamr@2
|
213 |
PKCS7_ENVELOPE *enveloped;
|
williamr@2
|
214 |
|
williamr@2
|
215 |
/* NID_pkcs7_signedAndEnveloped */
|
williamr@2
|
216 |
PKCS7_SIGN_ENVELOPE *signed_and_enveloped;
|
williamr@2
|
217 |
|
williamr@2
|
218 |
/* NID_pkcs7_digest */
|
williamr@2
|
219 |
PKCS7_DIGEST *digest;
|
williamr@2
|
220 |
|
williamr@2
|
221 |
/* NID_pkcs7_encrypted */
|
williamr@2
|
222 |
PKCS7_ENCRYPT *encrypted;
|
williamr@2
|
223 |
|
williamr@2
|
224 |
/* Anything else */
|
williamr@2
|
225 |
ASN1_TYPE *other;
|
williamr@2
|
226 |
} d;
|
williamr@2
|
227 |
} PKCS7;
|
williamr@2
|
228 |
|
williamr@2
|
229 |
DECLARE_STACK_OF(PKCS7)
|
williamr@2
|
230 |
DECLARE_ASN1_SET_OF(PKCS7)
|
williamr@2
|
231 |
DECLARE_PKCS12_STACK_OF(PKCS7)
|
williamr@2
|
232 |
|
williamr@2
|
233 |
#define PKCS7_OP_SET_DETACHED_SIGNATURE 1
|
williamr@2
|
234 |
#define PKCS7_OP_GET_DETACHED_SIGNATURE 2
|
williamr@2
|
235 |
|
williamr@2
|
236 |
#define PKCS7_get_signed_attributes(si) ((si)->auth_attr)
|
williamr@2
|
237 |
#define PKCS7_get_attributes(si) ((si)->unauth_attr)
|
williamr@2
|
238 |
|
williamr@2
|
239 |
#define PKCS7_type_is_signed(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_signed)
|
williamr@2
|
240 |
#define PKCS7_type_is_encrypted(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted)
|
williamr@2
|
241 |
#define PKCS7_type_is_enveloped(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_enveloped)
|
williamr@2
|
242 |
#define PKCS7_type_is_signedAndEnveloped(a) \
|
williamr@2
|
243 |
(OBJ_obj2nid((a)->type) == NID_pkcs7_signedAndEnveloped)
|
williamr@2
|
244 |
#define PKCS7_type_is_data(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_data)
|
williamr@2
|
245 |
|
williamr@2
|
246 |
#define PKCS7_type_is_digest(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_digest)
|
williamr@2
|
247 |
|
williamr@2
|
248 |
#define PKCS7_set_detached(p,v) \
|
williamr@2
|
249 |
PKCS7_ctrl(p,PKCS7_OP_SET_DETACHED_SIGNATURE,v,NULL)
|
williamr@2
|
250 |
#define PKCS7_get_detached(p) \
|
williamr@2
|
251 |
PKCS7_ctrl(p,PKCS7_OP_GET_DETACHED_SIGNATURE,0,NULL)
|
williamr@2
|
252 |
|
williamr@2
|
253 |
#define PKCS7_is_detached(p7) (PKCS7_type_is_signed(p7) && PKCS7_get_detached(p7))
|
williamr@2
|
254 |
|
williamr@2
|
255 |
#ifdef SSLEAY_MACROS
|
williamr@2
|
256 |
#ifndef PKCS7_ISSUER_AND_SERIAL_digest
|
williamr@2
|
257 |
#define PKCS7_ISSUER_AND_SERIAL_digest(data,type,md,len) \
|
williamr@2
|
258 |
ASN1_digest((int (*)())i2d_PKCS7_ISSUER_AND_SERIAL,type,\
|
williamr@2
|
259 |
(char *)data,md,len)
|
williamr@2
|
260 |
#endif
|
williamr@2
|
261 |
#endif
|
williamr@2
|
262 |
|
williamr@2
|
263 |
/* S/MIME related flags */
|
williamr@2
|
264 |
|
williamr@2
|
265 |
#define PKCS7_TEXT 0x1
|
williamr@2
|
266 |
#define PKCS7_NOCERTS 0x2
|
williamr@2
|
267 |
#define PKCS7_NOSIGS 0x4
|
williamr@2
|
268 |
#define PKCS7_NOCHAIN 0x8
|
williamr@2
|
269 |
#define PKCS7_NOINTERN 0x10
|
williamr@2
|
270 |
#define PKCS7_NOVERIFY 0x20
|
williamr@2
|
271 |
#define PKCS7_DETACHED 0x40
|
williamr@2
|
272 |
#define PKCS7_BINARY 0x80
|
williamr@2
|
273 |
#define PKCS7_NOATTR 0x100
|
williamr@2
|
274 |
#define PKCS7_NOSMIMECAP 0x200
|
williamr@2
|
275 |
#define PKCS7_NOOLDMIMETYPE 0x400
|
williamr@2
|
276 |
#define PKCS7_CRLFEOL 0x800
|
williamr@2
|
277 |
#define PKCS7_STREAM 0x1000
|
williamr@2
|
278 |
#define PKCS7_NOCRL 0x2000
|
williamr@2
|
279 |
|
williamr@2
|
280 |
/* Flags: for compatibility with older code */
|
williamr@2
|
281 |
|
williamr@2
|
282 |
#define SMIME_TEXT PKCS7_TEXT
|
williamr@2
|
283 |
#define SMIME_NOCERTS PKCS7_NOCERTS
|
williamr@2
|
284 |
#define SMIME_NOSIGS PKCS7_NOSIGS
|
williamr@2
|
285 |
#define SMIME_NOCHAIN PKCS7_NOCHAIN
|
williamr@2
|
286 |
#define SMIME_NOINTERN PKCS7_NOINTERN
|
williamr@2
|
287 |
#define SMIME_NOVERIFY PKCS7_NOVERIFY
|
williamr@2
|
288 |
#define SMIME_DETACHED PKCS7_DETACHED
|
williamr@2
|
289 |
#define SMIME_BINARY PKCS7_BINARY
|
williamr@2
|
290 |
#define SMIME_NOATTR PKCS7_NOATTR
|
williamr@2
|
291 |
|
williamr@2
|
292 |
DECLARE_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SERIAL)
|
williamr@2
|
293 |
|
williamr@2
|
294 |
#ifndef SSLEAY_MACROS
|
williamr@2
|
295 |
IMPORT_C int PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data,const EVP_MD *type,
|
williamr@2
|
296 |
unsigned char *md,unsigned int *len);
|
williamr@2
|
297 |
#ifndef OPENSSL_NO_FP_API
|
williamr@2
|
298 |
IMPORT_C PKCS7 *d2i_PKCS7_fp(FILE *fp,PKCS7 **p7);
|
williamr@2
|
299 |
IMPORT_C int i2d_PKCS7_fp(FILE *fp,PKCS7 *p7);
|
williamr@2
|
300 |
#endif
|
williamr@2
|
301 |
IMPORT_C PKCS7 *PKCS7_dup(PKCS7 *p7);
|
williamr@2
|
302 |
IMPORT_C PKCS7 *d2i_PKCS7_bio(BIO *bp,PKCS7 **p7);
|
williamr@2
|
303 |
IMPORT_C int i2d_PKCS7_bio(BIO *bp,PKCS7 *p7);
|
williamr@2
|
304 |
#endif
|
williamr@2
|
305 |
|
williamr@2
|
306 |
DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNER_INFO)
|
williamr@2
|
307 |
DECLARE_ASN1_FUNCTIONS(PKCS7_RECIP_INFO)
|
williamr@2
|
308 |
DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNED)
|
williamr@2
|
309 |
DECLARE_ASN1_FUNCTIONS(PKCS7_ENC_CONTENT)
|
williamr@2
|
310 |
DECLARE_ASN1_FUNCTIONS(PKCS7_ENVELOPE)
|
williamr@2
|
311 |
DECLARE_ASN1_FUNCTIONS(PKCS7_SIGN_ENVELOPE)
|
williamr@2
|
312 |
DECLARE_ASN1_FUNCTIONS(PKCS7_DIGEST)
|
williamr@2
|
313 |
DECLARE_ASN1_FUNCTIONS(PKCS7_ENCRYPT)
|
williamr@2
|
314 |
DECLARE_ASN1_FUNCTIONS(PKCS7)
|
williamr@2
|
315 |
|
williamr@2
|
316 |
DECLARE_ASN1_ITEM(PKCS7_ATTR_SIGN)
|
williamr@2
|
317 |
DECLARE_ASN1_ITEM(PKCS7_ATTR_VERIFY)
|
williamr@2
|
318 |
|
williamr@2
|
319 |
DECLARE_ASN1_NDEF_FUNCTION(PKCS7)
|
williamr@2
|
320 |
|
williamr@2
|
321 |
IMPORT_C long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg);
|
williamr@2
|
322 |
|
williamr@2
|
323 |
IMPORT_C int PKCS7_set_type(PKCS7 *p7, int type);
|
williamr@2
|
324 |
IMPORT_C int PKCS7_set0_type_other(PKCS7 *p7, int type, ASN1_TYPE *other);
|
williamr@2
|
325 |
IMPORT_C int PKCS7_set_content(PKCS7 *p7, PKCS7 *p7_data);
|
williamr@2
|
326 |
IMPORT_C int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey,
|
williamr@2
|
327 |
const EVP_MD *dgst);
|
williamr@2
|
328 |
IMPORT_C int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *p7i);
|
williamr@2
|
329 |
IMPORT_C int PKCS7_add_certificate(PKCS7 *p7, X509 *x509);
|
williamr@2
|
330 |
IMPORT_C int PKCS7_add_crl(PKCS7 *p7, X509_CRL *x509);
|
williamr@2
|
331 |
IMPORT_C int PKCS7_content_new(PKCS7 *p7, int nid);
|
williamr@2
|
332 |
IMPORT_C int PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx,
|
williamr@2
|
333 |
BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si);
|
williamr@2
|
334 |
IMPORT_C int PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si,
|
williamr@2
|
335 |
X509 *x509);
|
williamr@2
|
336 |
|
williamr@2
|
337 |
IMPORT_C BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio);
|
williamr@2
|
338 |
IMPORT_C int PKCS7_dataFinal(PKCS7 *p7, BIO *bio);
|
williamr@2
|
339 |
IMPORT_C BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert);
|
williamr@2
|
340 |
|
williamr@2
|
341 |
|
williamr@2
|
342 |
IMPORT_C PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509,
|
williamr@2
|
343 |
EVP_PKEY *pkey, const EVP_MD *dgst);
|
williamr@2
|
344 |
IMPORT_C X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si);
|
williamr@2
|
345 |
IMPORT_C int PKCS7_set_digest(PKCS7 *p7, const EVP_MD *md);
|
williamr@2
|
346 |
IMPORT_C STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7);
|
williamr@2
|
347 |
|
williamr@2
|
348 |
IMPORT_C PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509);
|
williamr@2
|
349 |
IMPORT_C int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri);
|
williamr@2
|
350 |
IMPORT_C int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509);
|
williamr@2
|
351 |
IMPORT_C int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher);
|
williamr@2
|
352 |
|
williamr@2
|
353 |
IMPORT_C PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx);
|
williamr@2
|
354 |
IMPORT_C ASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk);
|
williamr@2
|
355 |
IMPORT_C int PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si,int nid,int type,
|
williamr@2
|
356 |
void *data);
|
williamr@2
|
357 |
IMPORT_C int PKCS7_add_attribute (PKCS7_SIGNER_INFO *p7si, int nid, int atrtype,
|
williamr@2
|
358 |
void *value);
|
williamr@2
|
359 |
IMPORT_C ASN1_TYPE *PKCS7_get_attribute(PKCS7_SIGNER_INFO *si, int nid);
|
williamr@2
|
360 |
IMPORT_C ASN1_TYPE *PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid);
|
williamr@2
|
361 |
IMPORT_C int PKCS7_set_signed_attributes(PKCS7_SIGNER_INFO *p7si,
|
williamr@2
|
362 |
STACK_OF(X509_ATTRIBUTE) *sk);
|
williamr@2
|
363 |
IMPORT_C int PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si,STACK_OF(X509_ATTRIBUTE) *sk);
|
williamr@2
|
364 |
|
williamr@2
|
365 |
|
williamr@2
|
366 |
IMPORT_C PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
|
williamr@2
|
367 |
BIO *data, int flags);
|
williamr@2
|
368 |
IMPORT_C int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
|
williamr@2
|
369 |
BIO *indata, BIO *out, int flags);
|
williamr@2
|
370 |
IMPORT_C STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags);
|
williamr@2
|
371 |
IMPORT_C PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher,
|
williamr@2
|
372 |
int flags);
|
williamr@2
|
373 |
IMPORT_C int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags);
|
williamr@2
|
374 |
|
williamr@2
|
375 |
IMPORT_C int PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si,
|
williamr@2
|
376 |
STACK_OF(X509_ALGOR) *cap);
|
williamr@2
|
377 |
IMPORT_C STACK_OF(X509_ALGOR) *PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si);
|
williamr@2
|
378 |
IMPORT_C int PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg);
|
williamr@2
|
379 |
|
williamr@2
|
380 |
IMPORT_C int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags);
|
williamr@2
|
381 |
IMPORT_C PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont);
|
williamr@2
|
382 |
IMPORT_C int SMIME_crlf_copy(BIO *in, BIO *out, int flags);
|
williamr@2
|
383 |
IMPORT_C int SMIME_text(BIO *in, BIO *out);
|
williamr@2
|
384 |
|
williamr@2
|
385 |
/* BEGIN ERROR CODES */
|
williamr@2
|
386 |
/* The following lines are auto generated by the script mkerr.pl. Any changes
|
williamr@2
|
387 |
* made after this point may be overwritten when the script is next run.
|
williamr@2
|
388 |
*/
|
williamr@2
|
389 |
IMPORT_C void ERR_load_PKCS7_strings(void);
|
williamr@2
|
390 |
|
williamr@2
|
391 |
/* Error codes for the PKCS7 functions. */
|
williamr@2
|
392 |
|
williamr@2
|
393 |
/* Function codes. */
|
williamr@2
|
394 |
#define PKCS7_F_B64_READ_PKCS7 120
|
williamr@2
|
395 |
#define PKCS7_F_B64_WRITE_PKCS7 121
|
williamr@2
|
396 |
#define PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP 118
|
williamr@2
|
397 |
#define PKCS7_F_PKCS7_ADD_CERTIFICATE 100
|
williamr@2
|
398 |
#define PKCS7_F_PKCS7_ADD_CRL 101
|
williamr@2
|
399 |
#define PKCS7_F_PKCS7_ADD_RECIPIENT_INFO 102
|
williamr@2
|
400 |
#define PKCS7_F_PKCS7_ADD_SIGNER 103
|
williamr@2
|
401 |
#define PKCS7_F_PKCS7_BIO_ADD_DIGEST 125
|
williamr@2
|
402 |
#define PKCS7_F_PKCS7_CTRL 104
|
williamr@2
|
403 |
#define PKCS7_F_PKCS7_DATADECODE 112
|
williamr@2
|
404 |
#define PKCS7_F_PKCS7_DATAFINAL 128
|
williamr@2
|
405 |
#define PKCS7_F_PKCS7_DATAINIT 105
|
williamr@2
|
406 |
#define PKCS7_F_PKCS7_DATASIGN 106
|
williamr@2
|
407 |
#define PKCS7_F_PKCS7_DATAVERIFY 107
|
williamr@2
|
408 |
#define PKCS7_F_PKCS7_DECRYPT 114
|
williamr@2
|
409 |
#define PKCS7_F_PKCS7_ENCRYPT 115
|
williamr@2
|
410 |
#define PKCS7_F_PKCS7_FIND_DIGEST 127
|
williamr@2
|
411 |
#define PKCS7_F_PKCS7_GET0_SIGNERS 124
|
williamr@2
|
412 |
#define PKCS7_F_PKCS7_SET_CIPHER 108
|
williamr@2
|
413 |
#define PKCS7_F_PKCS7_SET_CONTENT 109
|
williamr@2
|
414 |
#define PKCS7_F_PKCS7_SET_DIGEST 126
|
williamr@2
|
415 |
#define PKCS7_F_PKCS7_SET_TYPE 110
|
williamr@2
|
416 |
#define PKCS7_F_PKCS7_SIGN 116
|
williamr@2
|
417 |
#define PKCS7_F_PKCS7_SIGNATUREVERIFY 113
|
williamr@2
|
418 |
#define PKCS7_F_PKCS7_SIMPLE_SMIMECAP 119
|
williamr@2
|
419 |
#define PKCS7_F_PKCS7_VERIFY 117
|
williamr@2
|
420 |
#define PKCS7_F_SMIME_READ_PKCS7 122
|
williamr@2
|
421 |
#define PKCS7_F_SMIME_TEXT 123
|
williamr@2
|
422 |
|
williamr@2
|
423 |
/* Reason codes. */
|
williamr@2
|
424 |
#define PKCS7_R_CERTIFICATE_VERIFY_ERROR 117
|
williamr@2
|
425 |
#define PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 144
|
williamr@2
|
426 |
#define PKCS7_R_CIPHER_NOT_INITIALIZED 116
|
williamr@2
|
427 |
#define PKCS7_R_CONTENT_AND_DATA_PRESENT 118
|
williamr@2
|
428 |
#define PKCS7_R_DECODE_ERROR 130
|
williamr@2
|
429 |
#define PKCS7_R_DECRYPTED_KEY_IS_WRONG_LENGTH 100
|
williamr@2
|
430 |
#define PKCS7_R_DECRYPT_ERROR 119
|
williamr@2
|
431 |
#define PKCS7_R_DIGEST_FAILURE 101
|
williamr@2
|
432 |
#define PKCS7_R_ERROR_ADDING_RECIPIENT 120
|
williamr@2
|
433 |
#define PKCS7_R_ERROR_SETTING_CIPHER 121
|
williamr@2
|
434 |
#define PKCS7_R_INVALID_MIME_TYPE 131
|
williamr@2
|
435 |
#define PKCS7_R_INVALID_NULL_POINTER 143
|
williamr@2
|
436 |
#define PKCS7_R_MIME_NO_CONTENT_TYPE 132
|
williamr@2
|
437 |
#define PKCS7_R_MIME_PARSE_ERROR 133
|
williamr@2
|
438 |
#define PKCS7_R_MIME_SIG_PARSE_ERROR 134
|
williamr@2
|
439 |
#define PKCS7_R_MISSING_CERIPEND_INFO 103
|
williamr@2
|
440 |
#define PKCS7_R_NO_CONTENT 122
|
williamr@2
|
441 |
#define PKCS7_R_NO_CONTENT_TYPE 135
|
williamr@2
|
442 |
#define PKCS7_R_NO_MULTIPART_BODY_FAILURE 136
|
williamr@2
|
443 |
#define PKCS7_R_NO_MULTIPART_BOUNDARY 137
|
williamr@2
|
444 |
#define PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE 115
|
williamr@2
|
445 |
#define PKCS7_R_NO_RECIPIENT_MATCHES_KEY 146
|
williamr@2
|
446 |
#define PKCS7_R_NO_SIGNATURES_ON_DATA 123
|
williamr@2
|
447 |
#define PKCS7_R_NO_SIGNERS 142
|
williamr@2
|
448 |
#define PKCS7_R_NO_SIG_CONTENT_TYPE 138
|
williamr@2
|
449 |
#define PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE 104
|
williamr@2
|
450 |
#define PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR 124
|
williamr@2
|
451 |
#define PKCS7_R_PKCS7_DATAFINAL 126
|
williamr@2
|
452 |
#define PKCS7_R_PKCS7_DATAFINAL_ERROR 125
|
williamr@2
|
453 |
#define PKCS7_R_PKCS7_DATASIGN 145
|
williamr@2
|
454 |
#define PKCS7_R_PKCS7_PARSE_ERROR 139
|
williamr@2
|
455 |
#define PKCS7_R_PKCS7_SIG_PARSE_ERROR 140
|
williamr@2
|
456 |
#define PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 127
|
williamr@2
|
457 |
#define PKCS7_R_SIGNATURE_FAILURE 105
|
williamr@2
|
458 |
#define PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND 128
|
williamr@2
|
459 |
#define PKCS7_R_SIG_INVALID_MIME_TYPE 141
|
williamr@2
|
460 |
#define PKCS7_R_SMIME_TEXT_ERROR 129
|
williamr@2
|
461 |
#define PKCS7_R_UNABLE_TO_FIND_CERTIFICATE 106
|
williamr@2
|
462 |
#define PKCS7_R_UNABLE_TO_FIND_MEM_BIO 107
|
williamr@2
|
463 |
#define PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST 108
|
williamr@2
|
464 |
#define PKCS7_R_UNKNOWN_DIGEST_TYPE 109
|
williamr@2
|
465 |
#define PKCS7_R_UNKNOWN_OPERATION 110
|
williamr@2
|
466 |
#define PKCS7_R_UNSUPPORTED_CIPHER_TYPE 111
|
williamr@2
|
467 |
#define PKCS7_R_UNSUPPORTED_CONTENT_TYPE 112
|
williamr@2
|
468 |
#define PKCS7_R_WRONG_CONTENT_TYPE 113
|
williamr@2
|
469 |
#define PKCS7_R_WRONG_PKCS7_TYPE 114
|
williamr@2
|
470 |
|
williamr@2
|
471 |
#ifdef __cplusplus
|
williamr@2
|
472 |
}
|
williamr@2
|
473 |
#endif
|
williamr@2
|
474 |
#endif
|