4b36a69c4f2981a690535b737f60d8758774dce5
[openssl.git] / crypto / cms / cms.h
1 /* crypto/cms/cms.h */
2 /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3  * project.
4  */
5 /* ====================================================================
6  * Copyright (c) 2008 The OpenSSL Project.  All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer. 
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in
17  *    the documentation and/or other materials provided with the
18  *    distribution.
19  *
20  * 3. All advertising materials mentioning features or use of this
21  *    software must display the following acknowledgment:
22  *    "This product includes software developed by the OpenSSL Project
23  *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24  *
25  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26  *    endorse or promote products derived from this software without
27  *    prior written permission. For written permission, please contact
28  *    licensing@OpenSSL.org.
29  *
30  * 5. Products derived from this software may not be called "OpenSSL"
31  *    nor may "OpenSSL" appear in their names without prior written
32  *    permission of the OpenSSL Project.
33  *
34  * 6. Redistributions of any form whatsoever must retain the following
35  *    acknowledgment:
36  *    "This product includes software developed by the OpenSSL Project
37  *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38  *
39  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
43  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50  * OF THE POSSIBILITY OF SUCH DAMAGE.
51  * ====================================================================
52  */
53
54
55 #ifndef HEADER_CMS_H
56 #define HEADER_CMS_H
57
58 #include <openssl/x509.h>
59
60 #ifdef OPENSSL_NO_CMS
61 #error CMS is disabled.
62 #endif
63
64 #ifdef __cplusplus
65 extern "C" {
66 #endif
67
68
69 typedef struct CMS_ContentInfo_st CMS_ContentInfo;
70 typedef struct CMS_SignerInfo_st CMS_SignerInfo;
71 typedef struct CMS_CertificateChoices CMS_CertificateChoices;
72 typedef struct CMS_RevocationInfoChoice_st CMS_RevocationInfoChoice;
73 typedef struct CMS_RecipientInfo_st CMS_RecipientInfo;
74 typedef struct CMS_ReceiptRequest_st CMS_ReceiptRequest;
75 typedef struct CMS_Receipt_st CMS_Receipt;
76 typedef struct CMS_RecipientEncryptedKey_st CMS_RecipientEncryptedKey;
77 typedef struct CMS_OtherKeyAttribute_st CMS_OtherKeyAttribute;
78
79 DECLARE_STACK_OF(CMS_SignerInfo)
80 DECLARE_STACK_OF(GENERAL_NAMES)
81 DECLARE_STACK_OF(CMS_RecipientEncryptedKey)
82 DECLARE_ASN1_FUNCTIONS(CMS_ContentInfo)
83 DECLARE_ASN1_FUNCTIONS(CMS_ReceiptRequest)
84 DECLARE_ASN1_PRINT_FUNCTION(CMS_ContentInfo)
85
86 #define CMS_SIGNERINFO_ISSUER_SERIAL    0
87 #define CMS_SIGNERINFO_KEYIDENTIFIER    1
88
89 #define CMS_RECIPINFO_NONE              -1
90 #define CMS_RECIPINFO_TRANS             0
91 #define CMS_RECIPINFO_AGREE             1
92 #define CMS_RECIPINFO_KEK               2
93 #define CMS_RECIPINFO_PASS              3
94 #define CMS_RECIPINFO_OTHER             4
95
96 /* S/MIME related flags */
97
98 #define CMS_TEXT                        0x1
99 #define CMS_NOCERTS                     0x2
100 #define CMS_NO_CONTENT_VERIFY           0x4
101 #define CMS_NO_ATTR_VERIFY              0x8
102 #define CMS_NOSIGS                      \
103                         (CMS_NO_CONTENT_VERIFY|CMS_NO_ATTR_VERIFY)
104 #define CMS_NOINTERN                    0x10
105 #define CMS_NO_SIGNER_CERT_VERIFY       0x20
106 #define CMS_NOVERIFY                    0x20
107 #define CMS_DETACHED                    0x40
108 #define CMS_BINARY                      0x80
109 #define CMS_NOATTR                      0x100
110 #define CMS_NOSMIMECAP                  0x200
111 #define CMS_NOOLDMIMETYPE               0x400
112 #define CMS_CRLFEOL                     0x800
113 #define CMS_STREAM                      0x1000
114 #define CMS_NOCRL                       0x2000
115 #define CMS_PARTIAL                     0x4000
116 #define CMS_REUSE_DIGEST                0x8000
117 #define CMS_USE_KEYID                   0x10000
118 #define CMS_DEBUG_DECRYPT               0x20000
119 #define CMS_KEY_PARAM                   0x40000
120
121 const ASN1_OBJECT *CMS_get0_type(CMS_ContentInfo *cms);
122
123 BIO *CMS_dataInit(CMS_ContentInfo *cms, BIO *icont);
124 int CMS_dataFinal(CMS_ContentInfo *cms, BIO *bio);
125
126 ASN1_OCTET_STRING **CMS_get0_content(CMS_ContentInfo *cms);
127 int CMS_is_detached(CMS_ContentInfo *cms);
128 int CMS_set_detached(CMS_ContentInfo *cms, int detached);
129
130 #ifdef HEADER_PEM_H
131 DECLARE_PEM_rw_const(CMS, CMS_ContentInfo)
132 #endif
133
134 int CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms);
135 CMS_ContentInfo *d2i_CMS_bio(BIO *bp, CMS_ContentInfo **cms);
136 int i2d_CMS_bio(BIO *bp, CMS_ContentInfo *cms);
137
138 BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms);
139 int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags);
140 int PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags);
141 CMS_ContentInfo *SMIME_read_CMS(BIO *bio, BIO **bcont);
142 int SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags);
143
144 int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont, unsigned int flags);
145
146 CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
147                                                 BIO *data, unsigned int flags);
148
149 CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si,
150                                         X509 *signcert, EVP_PKEY *pkey,
151                                         STACK_OF(X509) *certs,
152                                         unsigned int flags);
153
154 int CMS_data(CMS_ContentInfo *cms, BIO *out, unsigned int flags);
155 CMS_ContentInfo *CMS_data_create(BIO *in, unsigned int flags);
156
157 int CMS_digest_verify(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
158                                                         unsigned int flags);
159 CMS_ContentInfo *CMS_digest_create(BIO *in, const EVP_MD *md,
160                                                         unsigned int flags);
161
162 int CMS_EncryptedData_decrypt(CMS_ContentInfo *cms,
163                                 const unsigned char *key, size_t keylen,
164                                 BIO *dcont, BIO *out, unsigned int flags);
165
166 CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher,
167                                         const unsigned char *key, size_t keylen,
168                                         unsigned int flags);
169
170 int CMS_EncryptedData_set1_key(CMS_ContentInfo *cms, const EVP_CIPHER *ciph,
171                                 const unsigned char *key, size_t keylen);
172
173 int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs,
174                  X509_STORE *store, BIO *dcont, BIO *out, unsigned int flags);
175
176 int CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms,
177                         STACK_OF(X509) *certs,
178                         X509_STORE *store, unsigned int flags);
179
180 STACK_OF(X509) *CMS_get0_signers(CMS_ContentInfo *cms);
181
182 CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *in,
183                                 const EVP_CIPHER *cipher, unsigned int flags);
184
185 int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pkey, X509 *cert,
186                                 BIO *dcont, BIO *out,
187                                 unsigned int flags);
188         
189 int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert);
190 int CMS_decrypt_set1_key(CMS_ContentInfo *cms, 
191                                 unsigned char *key, size_t keylen,
192                                 unsigned char *id, size_t idlen);
193 int CMS_decrypt_set1_password(CMS_ContentInfo *cms, 
194                                 unsigned char *pass, ossl_ssize_t passlen);
195
196 STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms);
197 int CMS_RecipientInfo_type(CMS_RecipientInfo *ri);
198 EVP_PKEY_CTX *CMS_RecipientInfo_get0_pkey_ctx(CMS_RecipientInfo *ri);
199 CMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher);
200 CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms,
201                                         X509 *recip, unsigned int flags);
202 int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey);
203 int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert);
204 int CMS_RecipientInfo_ktri_get0_algs(CMS_RecipientInfo *ri,
205                                         EVP_PKEY **pk, X509 **recip,
206                                         X509_ALGOR **palg);
207 int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri,
208                                         ASN1_OCTET_STRING **keyid,
209                                         X509_NAME **issuer, ASN1_INTEGER **sno);
210
211 CMS_RecipientInfo *CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid,
212                                         unsigned char *key, size_t keylen,
213                                         unsigned char *id, size_t idlen,
214                                         ASN1_GENERALIZEDTIME *date,
215                                         ASN1_OBJECT *otherTypeId,
216                                         ASN1_TYPE *otherType);
217
218 int CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri,
219                                         X509_ALGOR **palg,
220                                         ASN1_OCTET_STRING **pid,
221                                         ASN1_GENERALIZEDTIME **pdate,
222                                         ASN1_OBJECT **potherid,
223                                         ASN1_TYPE **pothertype);
224
225 int CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri, 
226                                 unsigned char *key, size_t keylen);
227
228 int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri, 
229                                         const unsigned char *id, size_t idlen);
230
231 int CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri, 
232                                         unsigned char *pass,
233                                         ossl_ssize_t passlen);
234
235 CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms,
236                                         int iter, int wrap_nid, int pbe_nid,
237                                         unsigned char *pass,
238                                         ossl_ssize_t passlen,
239                                         const EVP_CIPHER *kekciph);
240
241 int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);
242 int CMS_RecipientInfo_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);
243         
244 int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
245                                                         unsigned int flags);
246 CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags);
247
248 int CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid);
249 const ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms);
250
251 CMS_CertificateChoices *CMS_add0_CertificateChoices(CMS_ContentInfo *cms);
252 int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert);
253 int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert);
254 STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms);
255
256 CMS_RevocationInfoChoice *CMS_add0_RevocationInfoChoice(CMS_ContentInfo *cms);
257 int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl);
258 int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl);
259 STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms);
260
261 int CMS_SignedData_init(CMS_ContentInfo *cms);
262 CMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms,
263                         X509 *signer, EVP_PKEY *pk, const EVP_MD *md,
264                         unsigned int flags);
265 EVP_PKEY_CTX *CMS_SignerInfo_get0_pkey_ctx(CMS_SignerInfo *si);
266 EVP_MD_CTX *CMS_SignerInfo_get0_md_ctx(CMS_SignerInfo *si);
267 STACK_OF(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo *cms);
268
269 void CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer);
270 int CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si,
271                                         ASN1_OCTET_STRING **keyid,
272                                         X509_NAME **issuer, ASN1_INTEGER **sno);
273 int CMS_SignerInfo_cert_cmp(CMS_SignerInfo *si, X509 *cert);
274 int CMS_set1_signers_certs(CMS_ContentInfo *cms, STACK_OF(X509) *certs,
275                                         unsigned int flags);
276 void CMS_SignerInfo_get0_algs(CMS_SignerInfo *si, EVP_PKEY **pk, X509 **signer,
277                                         X509_ALGOR **pdig, X509_ALGOR **psig);
278 ASN1_OCTET_STRING *CMS_SignerInfo_get0_signature(CMS_SignerInfo *si);
279 int CMS_SignerInfo_sign(CMS_SignerInfo *si);
280 int CMS_SignerInfo_verify(CMS_SignerInfo *si);
281 int CMS_SignerInfo_verify_content(CMS_SignerInfo *si, BIO *chain);
282
283 int CMS_add_smimecap(CMS_SignerInfo *si, STACK_OF(X509_ALGOR) *algs);
284 int CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **algs,
285                                 int algnid, int keysize);
286 int CMS_add_standard_smimecap(STACK_OF(X509_ALGOR) **smcap);
287
288 int CMS_signed_get_attr_count(const CMS_SignerInfo *si);
289 int CMS_signed_get_attr_by_NID(const CMS_SignerInfo *si, int nid,
290                           int lastpos);
291 int CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, ASN1_OBJECT *obj,
292                           int lastpos);
293 X509_ATTRIBUTE *CMS_signed_get_attr(const CMS_SignerInfo *si, int loc);
294 X509_ATTRIBUTE *CMS_signed_delete_attr(CMS_SignerInfo *si, int loc);
295 int CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr);
296 int CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si,
297                         const ASN1_OBJECT *obj, int type,
298                         const void *bytes, int len);
299 int CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si,
300                         int nid, int type,
301                         const void *bytes, int len);
302 int CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si,
303                         const char *attrname, int type,
304                         const void *bytes, int len);
305 void *CMS_signed_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid,
306                                         int lastpos, int type);
307
308 int CMS_unsigned_get_attr_count(const CMS_SignerInfo *si);
309 int CMS_unsigned_get_attr_by_NID(const CMS_SignerInfo *si, int nid,
310                           int lastpos);
311 int CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si, ASN1_OBJECT *obj,
312                           int lastpos);
313 X509_ATTRIBUTE *CMS_unsigned_get_attr(const CMS_SignerInfo *si, int loc);
314 X509_ATTRIBUTE *CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc);
315 int CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr);
316 int CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si,
317                         const ASN1_OBJECT *obj, int type,
318                         const void *bytes, int len);
319 int CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si,
320                         int nid, int type,
321                         const void *bytes, int len);
322 int CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si,
323                         const char *attrname, int type,
324                         const void *bytes, int len);
325 void *CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid,
326                                         int lastpos, int type);
327
328 #ifdef HEADER_X509V3_H
329
330 int CMS_get1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest **prr);
331 CMS_ReceiptRequest *CMS_ReceiptRequest_create0(unsigned char *id, int idlen,
332                                 int allorfirst,
333                                 STACK_OF(GENERAL_NAMES) *receiptList,
334                                 STACK_OF(GENERAL_NAMES) *receiptsTo);
335 int CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr);
336 void CMS_ReceiptRequest_get0_values(CMS_ReceiptRequest *rr,
337                                         ASN1_STRING **pcid,
338                                         int *pallorfirst,
339                                         STACK_OF(GENERAL_NAMES) **plist,
340                                         STACK_OF(GENERAL_NAMES) **prto);
341 #endif
342 int CMS_RecipientInfo_kari_get0_alg(CMS_RecipientInfo *ri,
343                                         X509_ALGOR **palg,
344                                         ASN1_OCTET_STRING **pukm);
345 STACK_OF(CMS_RecipientEncryptedKey) *
346         CMS_RecipientInfo_kari_get0_reks(CMS_RecipientInfo *ri);
347
348 int CMS_RecipientInfo_kari_get0_orig_id(CMS_RecipientInfo *ri,
349                                         X509_ALGOR **pubalg,
350                                         ASN1_BIT_STRING **pubkey,
351                                         ASN1_OCTET_STRING **keyid,
352                                         X509_NAME **issuer, ASN1_INTEGER **sno);
353
354 int CMS_RecipientInfo_kari_orig_id_cmp(CMS_RecipientInfo *ri, X509 *cert);
355         
356 int CMS_RecipientEncryptedKey_get0_id(CMS_RecipientEncryptedKey *rek,
357                                         ASN1_OCTET_STRING **keyid,
358                                         ASN1_GENERALIZEDTIME **tm,
359                                         CMS_OtherKeyAttribute **other,
360                                         X509_NAME **issuer, ASN1_INTEGER **sno);
361 int CMS_RecipientEncryptedKey_cert_cmp(CMS_RecipientEncryptedKey *rek,
362                                                 X509 *cert);
363 int CMS_RecipientInfo_kari_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pk);
364 EVP_CIPHER_CTX *CMS_RecipientInfo_kari_get0_ctx(CMS_RecipientInfo *ri);
365 int CMS_RecipientInfo_kari_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri,
366                                         CMS_RecipientEncryptedKey *rek);
367
368 int CMS_SharedInfo_encode(unsigned char **pder, X509_ALGOR *kekalg, 
369                         ASN1_OCTET_STRING *ukm, int keylen);
370
371 /* BEGIN ERROR CODES */
372 /* The following lines are auto generated by the script mkerr.pl. Any changes
373  * made after this point may be overwritten when the script is next run.
374  */
375 void ERR_load_CMS_strings(void);
376
377 /* Error codes for the CMS functions. */
378
379 /* Function codes. */
380 #define CMS_F_CHECK_CONTENT                              99
381 #define CMS_F_CMS_ADD0_CERT                              164
382 #define CMS_F_CMS_ADD0_RECIPIENT_KEY                     100
383 #define CMS_F_CMS_ADD0_RECIPIENT_PASSWORD                165
384 #define CMS_F_CMS_ADD1_RECEIPTREQUEST                    158
385 #define CMS_F_CMS_ADD1_RECIPIENT_CERT                    101
386 #define CMS_F_CMS_ADD1_SIGNER                            102
387 #define CMS_F_CMS_ADD1_SIGNINGTIME                       103
388 #define CMS_F_CMS_COMPRESS                               104
389 #define CMS_F_CMS_COMPRESSEDDATA_CREATE                  105
390 #define CMS_F_CMS_COMPRESSEDDATA_INIT_BIO                106
391 #define CMS_F_CMS_COPY_CONTENT                           107
392 #define CMS_F_CMS_COPY_MESSAGEDIGEST                     108
393 #define CMS_F_CMS_DATA                                   109
394 #define CMS_F_CMS_DATAFINAL                              110
395 #define CMS_F_CMS_DATAINIT                               111
396 #define CMS_F_CMS_DECRYPT                                112
397 #define CMS_F_CMS_DECRYPT_SET1_KEY                       113
398 #define CMS_F_CMS_DECRYPT_SET1_PASSWORD                  166
399 #define CMS_F_CMS_DECRYPT_SET1_PKEY                      114
400 #define CMS_F_CMS_DIGESTALGORITHM_FIND_CTX               115
401 #define CMS_F_CMS_DIGESTALGORITHM_INIT_BIO               116
402 #define CMS_F_CMS_DIGESTEDDATA_DO_FINAL                  117
403 #define CMS_F_CMS_DIGEST_VERIFY                          118
404 #define CMS_F_CMS_ENCODE_RECEIPT                         161
405 #define CMS_F_CMS_ENCRYPT                                119
406 #define CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO              120
407 #define CMS_F_CMS_ENCRYPTEDDATA_DECRYPT                  121
408 #define CMS_F_CMS_ENCRYPTEDDATA_ENCRYPT                  122
409 #define CMS_F_CMS_ENCRYPTEDDATA_SET1_KEY                 123
410 #define CMS_F_CMS_ENVELOPEDDATA_CREATE                   124
411 #define CMS_F_CMS_ENVELOPEDDATA_INIT_BIO                 125
412 #define CMS_F_CMS_ENVELOPED_DATA_INIT                    126
413 #define CMS_F_CMS_ENV_ASN1_CTRL                          171
414 #define CMS_F_CMS_FINAL                                  127
415 #define CMS_F_CMS_GET0_CERTIFICATE_CHOICES               128
416 #define CMS_F_CMS_GET0_CONTENT                           129
417 #define CMS_F_CMS_GET0_ECONTENT_TYPE                     130
418 #define CMS_F_CMS_GET0_ENVELOPED                         131
419 #define CMS_F_CMS_GET0_REVOCATION_CHOICES                132
420 #define CMS_F_CMS_GET0_SIGNED                            133
421 #define CMS_F_CMS_MSGSIGDIGEST_ADD1                      162
422 #define CMS_F_CMS_RECEIPTREQUEST_CREATE0                 159
423 #define CMS_F_CMS_RECEIPT_VERIFY                         160
424 #define CMS_F_CMS_RECIPIENTINFO_DECRYPT                  134
425 #define CMS_F_CMS_RECIPIENTINFO_ENCRYPT                  169
426 #define CMS_F_CMS_RECIPIENTINFO_KARI_ENCRYPT             178
427 #define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_ALG            175
428 #define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_ORIG_ID        173
429 #define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_REKS           172
430 #define CMS_F_CMS_RECIPIENTINFO_KARI_ORIG_ID_CMP         174
431 #define CMS_F_CMS_RECIPIENTINFO_KEKRI_DECRYPT            135
432 #define CMS_F_CMS_RECIPIENTINFO_KEKRI_ENCRYPT            136
433 #define CMS_F_CMS_RECIPIENTINFO_KEKRI_GET0_ID            137
434 #define CMS_F_CMS_RECIPIENTINFO_KEKRI_ID_CMP             138
435 #define CMS_F_CMS_RECIPIENTINFO_KTRI_CERT_CMP            139
436 #define CMS_F_CMS_RECIPIENTINFO_KTRI_DECRYPT             140
437 #define CMS_F_CMS_RECIPIENTINFO_KTRI_ENCRYPT             141
438 #define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_ALGS           142
439 #define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_SIGNER_ID      143
440 #define CMS_F_CMS_RECIPIENTINFO_PWRI_CRYPT               167
441 #define CMS_F_CMS_RECIPIENTINFO_SET0_KEY                 144
442 #define CMS_F_CMS_RECIPIENTINFO_SET0_PASSWORD            168
443 #define CMS_F_CMS_RECIPIENTINFO_SET0_PKEY                145
444 #define CMS_F_CMS_SD_ASN1_CTRL                           170
445 #define CMS_F_CMS_SET1_IAS                               176
446 #define CMS_F_CMS_SET1_KEYID                             177
447 #define CMS_F_CMS_SET1_SIGNERIDENTIFIER                  146
448 #define CMS_F_CMS_SET_DETACHED                           147
449 #define CMS_F_CMS_SIGN                                   148
450 #define CMS_F_CMS_SIGNED_DATA_INIT                       149
451 #define CMS_F_CMS_SIGNERINFO_CONTENT_SIGN                150
452 #define CMS_F_CMS_SIGNERINFO_SIGN                        151
453 #define CMS_F_CMS_SIGNERINFO_VERIFY                      152
454 #define CMS_F_CMS_SIGNERINFO_VERIFY_CERT                 153
455 #define CMS_F_CMS_SIGNERINFO_VERIFY_CONTENT              154
456 #define CMS_F_CMS_SIGN_RECEIPT                           163
457 #define CMS_F_CMS_STREAM                                 155
458 #define CMS_F_CMS_UNCOMPRESS                             156
459 #define CMS_F_CMS_VERIFY                                 157
460
461 /* Reason codes. */
462 #define CMS_R_ADD_SIGNER_ERROR                           99
463 #define CMS_R_CERTIFICATE_ALREADY_PRESENT                175
464 #define CMS_R_CERTIFICATE_HAS_NO_KEYID                   160
465 #define CMS_R_CERTIFICATE_VERIFY_ERROR                   100
466 #define CMS_R_CIPHER_INITIALISATION_ERROR                101
467 #define CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR      102
468 #define CMS_R_CMS_DATAFINAL_ERROR                        103
469 #define CMS_R_CMS_LIB                                    104
470 #define CMS_R_CONTENTIDENTIFIER_MISMATCH                 170
471 #define CMS_R_CONTENT_NOT_FOUND                          105
472 #define CMS_R_CONTENT_TYPE_MISMATCH                      171
473 #define CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA           106
474 #define CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA            107
475 #define CMS_R_CONTENT_TYPE_NOT_SIGNED_DATA               108
476 #define CMS_R_CONTENT_VERIFY_ERROR                       109
477 #define CMS_R_CTRL_ERROR                                 110
478 #define CMS_R_CTRL_FAILURE                               111
479 #define CMS_R_DECRYPT_ERROR                              112
480 #define CMS_R_DIGEST_ERROR                               161
481 #define CMS_R_ERROR_GETTING_PUBLIC_KEY                   113
482 #define CMS_R_ERROR_READING_MESSAGEDIGEST_ATTRIBUTE      114
483 #define CMS_R_ERROR_SETTING_KEY                          115
484 #define CMS_R_ERROR_SETTING_RECIPIENTINFO                116
485 #define CMS_R_INVALID_ENCRYPTED_KEY_LENGTH               117
486 #define CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER           176
487 #define CMS_R_INVALID_KEY_LENGTH                         118
488 #define CMS_R_MD_BIO_INIT_ERROR                          119
489 #define CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH       120
490 #define CMS_R_MESSAGEDIGEST_WRONG_LENGTH                 121
491 #define CMS_R_MSGSIGDIGEST_ERROR                         172
492 #define CMS_R_MSGSIGDIGEST_VERIFICATION_FAILURE          162
493 #define CMS_R_MSGSIGDIGEST_WRONG_LENGTH                  163
494 #define CMS_R_NEED_ONE_SIGNER                            164
495 #define CMS_R_NOT_A_SIGNED_RECEIPT                       165
496 #define CMS_R_NOT_ENCRYPTED_DATA                         122
497 #define CMS_R_NOT_KEK                                    123
498 #define CMS_R_NOT_KEY_AGREEMENT                          181
499 #define CMS_R_NOT_KEY_TRANSPORT                          124
500 #define CMS_R_NOT_PWRI                                   177
501 #define CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE            125
502 #define CMS_R_NO_CIPHER                                  126
503 #define CMS_R_NO_CONTENT                                 127
504 #define CMS_R_NO_CONTENT_TYPE                            173
505 #define CMS_R_NO_DEFAULT_DIGEST                          128
506 #define CMS_R_NO_DIGEST_SET                              129
507 #define CMS_R_NO_KEY                                     130
508 #define CMS_R_NO_KEY_OR_CERT                             174
509 #define CMS_R_NO_MATCHING_DIGEST                         131
510 #define CMS_R_NO_MATCHING_RECIPIENT                      132
511 #define CMS_R_NO_MATCHING_SIGNATURE                      166
512 #define CMS_R_NO_MSGSIGDIGEST                            167
513 #define CMS_R_NO_PASSWORD                                178
514 #define CMS_R_NO_PRIVATE_KEY                             133
515 #define CMS_R_NO_PUBLIC_KEY                              134
516 #define CMS_R_NO_RECEIPT_REQUEST                         168
517 #define CMS_R_NO_SIGNERS                                 135
518 #define CMS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE     136
519 #define CMS_R_RECEIPT_DECODE_ERROR                       169
520 #define CMS_R_RECIPIENT_ERROR                            137
521 #define CMS_R_SIGNER_CERTIFICATE_NOT_FOUND               138
522 #define CMS_R_SIGNFINAL_ERROR                            139
523 #define CMS_R_SMIME_TEXT_ERROR                           140
524 #define CMS_R_STORE_INIT_ERROR                           141
525 #define CMS_R_TYPE_NOT_COMPRESSED_DATA                   142
526 #define CMS_R_TYPE_NOT_DATA                              143
527 #define CMS_R_TYPE_NOT_DIGESTED_DATA                     144
528 #define CMS_R_TYPE_NOT_ENCRYPTED_DATA                    145
529 #define CMS_R_TYPE_NOT_ENVELOPED_DATA                    146
530 #define CMS_R_UNABLE_TO_FINALIZE_CONTEXT                 147
531 #define CMS_R_UNKNOWN_CIPHER                             148
532 #define CMS_R_UNKNOWN_DIGEST_ALGORIHM                    149
533 #define CMS_R_UNKNOWN_ID                                 150
534 #define CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM          151
535 #define CMS_R_UNSUPPORTED_CONTENT_TYPE                   152
536 #define CMS_R_UNSUPPORTED_KEK_ALGORITHM                  153
537 #define CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM       179
538 #define CMS_R_UNSUPPORTED_RECIPIENT_TYPE                 154
539 #define CMS_R_UNSUPPORTED_RECPIENTINFO_TYPE              155
540 #define CMS_R_UNSUPPORTED_TYPE                           156
541 #define CMS_R_UNWRAP_ERROR                               157
542 #define CMS_R_UNWRAP_FAILURE                             180
543 #define CMS_R_VERIFICATION_FAILURE                       158
544 #define CMS_R_WRAP_ERROR                                 159
545
546 #ifdef  __cplusplus
547 }
548 #endif
549 #endif