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 module deimos.openssl.cms;
56 
57 import deimos.openssl._d_util;
58 
59 import deimos.openssl.asn1; // Needed for DECLARE_ASN1_*.
60 import deimos.openssl.x509v3; // Needed for GENERAL_NAMES.
61 
62 public import deimos.openssl.x509;
63 
64 version (OPENSSL_NO_CMS) {
65   static assert(false, "CMS is disabled.");
66 }
67 
68 extern (C):
69 nothrow:
70 
71 
72 struct CMS_ContentInfo_st;
73 alias CMS_ContentInfo_st CMS_ContentInfo;
74 struct CMS_SignerInfo_st;
75 alias CMS_SignerInfo_st CMS_SignerInfo;
76 // BUG/oversight in the original headers: _st suffix missing.
77 struct CMS_CertificateChoices;
78 struct CMS_RevocationInfoChoice_st;
79 alias CMS_RevocationInfoChoice_st CMS_RevocationInfoChoice;
80 struct CMS_RecipientInfo_st;
81 alias CMS_RecipientInfo_st CMS_RecipientInfo;
82 struct CMS_ReceiptRequest_st;
83 alias CMS_ReceiptRequest_st CMS_ReceiptRequest;
84 struct CMS_Receipt_st;
85 alias CMS_Receipt_st CMS_Receipt;
86 
87 /+mixin DECLARE_STACK_OF!(CMS_SignerInfo);+/
88 /+mixin DECLARE_STACK_OF!(GENERAL_NAMES);+/
89 mixin(DECLARE_ASN1_FUNCTIONS!"CMS_ContentInfo");
90 mixin(DECLARE_ASN1_FUNCTIONS!"CMS_ReceiptRequest");
91 mixin(DECLARE_ASN1_PRINT_FUNCTION!"CMS_ContentInfo");
92 
93 enum CMS_SIGNERINFO_ISSUER_SERIAL = 0;
94 enum CMS_SIGNERINFO_KEYIDENTIFIER = 1;
95 
96 enum CMS_RECIPINFO_TRANS = 0;
97 enum CMS_RECIPINFO_AGREE = 1;
98 enum CMS_RECIPINFO_KEK = 2;
99 enum CMS_RECIPINFO_PASS = 3;
100 enum CMS_RECIPINFO_OTHER = 4;
101 
102 /* S/MIME related flags */
103 
104 enum CMS_TEXT = 0x1;
105 enum CMS_NOCERTS = 0x2;
106 enum CMS_NO_CONTENT_VERIFY = 0x4;
107 enum CMS_NO_ATTR_VERIFY = 0x8;
108 enum CMS_NOSIGS = (CMS_NO_CONTENT_VERIFY|CMS_NO_ATTR_VERIFY);
109 enum CMS_NOINTERN = 0x10;
110 enum CMS_NO_SIGNER_CERT_VERIFY = 0x20;
111 enum CMS_NOVERIFY = 0x20;
112 enum CMS_DETACHED = 0x40;
113 enum CMS_BINARY = 0x80;
114 enum CMS_NOATTR = 0x100;
115 enum CMS_NOSMIMECAP = 0x200;
116 enum CMS_NOOLDMIMETYPE = 0x400;
117 enum CMS_CRLFEOL = 0x800;
118 enum CMS_STREAM = 0x1000;
119 enum CMS_NOCRL = 0x2000;
120 enum CMS_PARTIAL = 0x4000;
121 enum CMS_REUSE_DIGEST = 0x8000;
122 enum CMS_USE_KEYID = 0x10000;
123 enum CMS_DEBUG_DECRYPT = 0x20000;
124 
125 const(ASN1_OBJECT)* CMS_get0_type(CMS_ContentInfo* cms);
126 
127 BIO* CMS_dataInit(CMS_ContentInfo* cms, BIO* icont);
128 int CMS_dataFinal(CMS_ContentInfo* cms, BIO* bio);
129 
130 ASN1_OCTET_STRING** CMS_get0_content(CMS_ContentInfo* cms);
131 int CMS_is_detached(CMS_ContentInfo* cms);
132 int CMS_set_detached(CMS_ContentInfo* cms, int detached);
133 
134 // #ifdef HEADER_PEM_H
135 import deimos.openssl.pem;
136 mixin(DECLARE_PEM_rw_const!("CMS", "CMS_ContentInfo")());
137 // #endif
138 
139 int CMS_stream(ubyte*** boundary, CMS_ContentInfo* cms);
140 CMS_ContentInfo* d2i_CMS_bio(BIO* bp, CMS_ContentInfo** cms);
141 int i2d_CMS_bio(BIO* bp, CMS_ContentInfo* cms);
142 
143 BIO* BIO_new_CMS(BIO* out_, CMS_ContentInfo* cms);
144 int i2d_CMS_bio_stream(BIO* out_, CMS_ContentInfo* cms, BIO* in_, int flags);
145 int PEM_write_bio_CMS_stream(BIO* out_, CMS_ContentInfo* cms, BIO* in_, int flags);
146 CMS_ContentInfo* SMIME_read_CMS(BIO* bio, BIO** bcont);
147 int SMIME_write_CMS(BIO* bio, CMS_ContentInfo* cms, BIO* data, int flags);
148 
149 int CMS_final(CMS_ContentInfo* cms, BIO* data, BIO* dcont, uint flags);
150 
151 CMS_ContentInfo* CMS_sign(X509* signcert, EVP_PKEY* pkey, STACK_OF!(X509) *certs,
152 						BIO* data, uint flags);
153 
154 CMS_ContentInfo* CMS_sign_receipt(CMS_SignerInfo* si,
155 					X509* signcert, EVP_PKEY* pkey,
156 					STACK_OF!(X509) *certs,
157 					uint flags);
158 
159 int CMS_data(CMS_ContentInfo* cms, BIO* out_, uint flags);
160 CMS_ContentInfo* CMS_data_create(BIO* in_, uint flags);
161 
162 int CMS_digest_verify(CMS_ContentInfo* cms, BIO* dcont, BIO* out_,
163 							uint flags);
164 CMS_ContentInfo* CMS_digest_create(BIO* in_, const(EVP_MD)* md,
165 							uint flags);
166 
167 int CMS_EncryptedData_decrypt(CMS_ContentInfo* cms,
168 				const(ubyte)* key, size_t keylen,
169 				BIO* dcont, BIO* out_, uint flags);
170 
171 CMS_ContentInfo* CMS_EncryptedData_encrypt(BIO* in_, const(EVP_CIPHER)* cipher,
172 					const(ubyte)* key, size_t keylen,
173 					uint flags);
174 
175 int CMS_EncryptedData_set1_key(CMS_ContentInfo* cms, const(EVP_CIPHER)* ciph,
176 				const(ubyte)* key, size_t keylen);
177 
178 int CMS_verify(CMS_ContentInfo* cms, STACK_OF!(X509) *certs,
179 		 X509_STORE* store, BIO* dcont, BIO* out_, uint flags);
180 
181 int CMS_verify_receipt(CMS_ContentInfo* rcms, CMS_ContentInfo* ocms,
182 			STACK_OF!(X509) *certs,
183 			X509_STORE* store, uint flags);
184 
185 STACK_OF!(X509) *CMS_get0_signers(CMS_ContentInfo* cms);
186 
187 CMS_ContentInfo* CMS_encrypt(STACK_OF!(X509) *certs, BIO* in_,
188 				const(EVP_CIPHER)* cipher, uint flags);
189 
190 int CMS_decrypt(CMS_ContentInfo* cms, EVP_PKEY* pkey, X509* cert,
191 				BIO* dcont, BIO* out_,
192 				uint flags);
193 
194 int CMS_decrypt_set1_pkey(CMS_ContentInfo* cms, EVP_PKEY* pk, X509* cert);
195 int CMS_decrypt_set1_key(CMS_ContentInfo* cms,
196 				ubyte* key, size_t keylen,
197 				ubyte* id, size_t idlen);
198 int CMS_decrypt_set1_password(CMS_ContentInfo *cms, 
199 				ubyte *pass, ossl_ssize_t passlen);
200 
201 STACK_OF!(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo* cms);
202 int CMS_RecipientInfo_type(CMS_RecipientInfo* ri);
203 CMS_ContentInfo* CMS_EnvelopedData_create(const(EVP_CIPHER)* cipher);
204 CMS_RecipientInfo* CMS_add1_recipient_cert(CMS_ContentInfo* cms,
205 					X509* recip, uint flags);
206 int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo* ri, EVP_PKEY* pkey);
207 int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo* ri, X509* cert);
208 int CMS_RecipientInfo_ktri_get0_algs(CMS_RecipientInfo* ri,
209 					EVP_PKEY** pk, X509** recip,
210 					X509_ALGOR** palg);
211 int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo* ri,
212 					ASN1_OCTET_STRING** keyid,
213 					X509_NAME** issuer, ASN1_INTEGER** sno);
214 
215 CMS_RecipientInfo* CMS_add0_recipient_key(CMS_ContentInfo* cms, int nid,
216 					ubyte* key, size_t keylen,
217 					ubyte* id, size_t idlen,
218 					ASN1_GENERALIZEDTIME* date,
219 					ASN1_OBJECT* otherTypeId,
220 					ASN1_TYPE* otherType);
221 
222 int CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo* ri,
223 					X509_ALGOR** palg,
224 					ASN1_OCTET_STRING** pid,
225 					ASN1_GENERALIZEDTIME** pdate,
226 					ASN1_OBJECT** potherid,
227 					ASN1_TYPE** pothertype);
228 
229 int CMS_RecipientInfo_set0_key(CMS_RecipientInfo* ri,
230 				ubyte* key, size_t keylen);
231 
232 int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo* ri,
233 					const(ubyte)* id, size_t idlen);
234 
235 int CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri, 
236 					ubyte* pass,
237 					ossl_ssize_t passlen);
238 
239 CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms,
240 					int iter, int wrap_nid, int pbe_nid,
241 					ubyte* pass,
242 					ossl_ssize_t passlen,
243 					const(EVP_CIPHER)* kekciph);
244 
245 int CMS_RecipientInfo_decrypt(CMS_ContentInfo* cms, CMS_RecipientInfo* ri);
246 
247 int CMS_uncompress(CMS_ContentInfo* cms, BIO* dcont, BIO* out_,
248 							uint flags);
249 CMS_ContentInfo* CMS_compress(BIO* in_, int comp_nid, uint flags);
250 
251 int CMS_set1_eContentType(CMS_ContentInfo* cms, const(ASN1_OBJECT)* oid);
252 const(ASN1_OBJECT)* CMS_get0_eContentType(CMS_ContentInfo* cms);
253 
254 CMS_CertificateChoices* CMS_add0_CertificateChoices(CMS_ContentInfo* cms);
255 int CMS_add0_cert(CMS_ContentInfo* cms, X509* cert);
256 int CMS_add1_cert(CMS_ContentInfo* cms, X509* cert);
257 STACK_OF!(X509) *CMS_get1_certs(CMS_ContentInfo* cms);
258 
259 CMS_RevocationInfoChoice* CMS_add0_RevocationInfoChoice(CMS_ContentInfo* cms);
260 int CMS_add0_crl(CMS_ContentInfo* cms, X509_CRL* crl);
261 int CMS_add1_crl(CMS_ContentInfo* cms, X509_CRL* crl);
262 STACK_OF!(X509_CRL) *CMS_get1_crls(CMS_ContentInfo* cms);
263 
264 int CMS_SignedData_init(CMS_ContentInfo* cms);
265 CMS_SignerInfo* CMS_add1_signer(CMS_ContentInfo* cms,
266 			X509* signer, EVP_PKEY* pk, const(EVP_MD)* md,
267 			uint flags);
268 STACK_OF!(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo* cms);
269 
270 void CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo* si, X509* signer);
271 int CMS_SignerInfo_get0_signer_id(CMS_SignerInfo* si,
272 					ASN1_OCTET_STRING** keyid,
273 					X509_NAME** issuer, ASN1_INTEGER** sno);
274 int CMS_SignerInfo_cert_cmp(CMS_SignerInfo* si, X509* cert);
275 int CMS_set1_signers_certs(CMS_ContentInfo* cms, STACK_OF!(X509) *certs,
276 					uint flags);
277 void CMS_SignerInfo_get0_algs(CMS_SignerInfo* si, EVP_PKEY** pk, X509** signer,
278 					X509_ALGOR** pdig, X509_ALGOR** psig);
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(ubyte* 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 
342 // #endif
343 
344 /* BEGIN ERROR CODES */
345 /* The following lines are auto generated by the script mkerr.pl. Any changes
346  * made after this point may be overwritten when the script is next run.
347  */
348 void ERR_load_CMS_strings();
349 
350 /* Error codes for the CMS functions. */
351 
352 /* Function codes. */
353 enum CMS_F_CHECK_CONTENT = 99;
354 enum CMS_F_CMS_ADD0_CERT = 164;
355 enum CMS_F_CMS_ADD0_RECIPIENT_KEY = 100;
356 enum CMS_F_CMS_ADD0_RECIPIENT_PASSWORD = 165;
357 enum CMS_F_CMS_ADD1_RECEIPTREQUEST = 158;
358 enum CMS_F_CMS_ADD1_RECIPIENT_CERT = 101;
359 enum CMS_F_CMS_ADD1_SIGNER = 102;
360 enum CMS_F_CMS_ADD1_SIGNINGTIME = 103;
361 enum CMS_F_CMS_COMPRESS = 104;
362 enum CMS_F_CMS_COMPRESSEDDATA_CREATE = 105;
363 enum CMS_F_CMS_COMPRESSEDDATA_INIT_BIO = 106;
364 enum CMS_F_CMS_COPY_CONTENT = 107;
365 enum CMS_F_CMS_COPY_MESSAGEDIGEST = 108;
366 enum CMS_F_CMS_DATA = 109;
367 enum CMS_F_CMS_DATAFINAL = 110;
368 enum CMS_F_CMS_DATAINIT = 111;
369 enum CMS_F_CMS_DECRYPT = 112;
370 enum CMS_F_CMS_DECRYPT_SET1_KEY = 113;
371 enum CMS_F_CMS_DECRYPT_SET1_PASSWORD = 166;
372 enum CMS_F_CMS_DECRYPT_SET1_PKEY = 114;
373 enum CMS_F_CMS_DIGESTALGORITHM_FIND_CTX = 115;
374 enum CMS_F_CMS_DIGESTALGORITHM_INIT_BIO = 116;
375 enum CMS_F_CMS_DIGESTEDDATA_DO_FINAL = 117;
376 enum CMS_F_CMS_DIGEST_VERIFY = 118;
377 enum CMS_F_CMS_ENCODE_RECEIPT = 161;
378 enum CMS_F_CMS_ENCRYPT = 119;
379 enum CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO = 120;
380 enum CMS_F_CMS_ENCRYPTEDDATA_DECRYPT = 121;
381 enum CMS_F_CMS_ENCRYPTEDDATA_ENCRYPT = 122;
382 enum CMS_F_CMS_ENCRYPTEDDATA_SET1_KEY = 123;
383 enum CMS_F_CMS_ENVELOPEDDATA_CREATE = 124;
384 enum CMS_F_CMS_ENVELOPEDDATA_INIT_BIO = 125;
385 enum CMS_F_CMS_ENVELOPED_DATA_INIT = 126;
386 enum CMS_F_CMS_FINAL = 127;
387 enum CMS_F_CMS_GET0_CERTIFICATE_CHOICES = 128;
388 enum CMS_F_CMS_GET0_CONTENT = 129;
389 enum CMS_F_CMS_GET0_ECONTENT_TYPE = 130;
390 enum CMS_F_CMS_GET0_ENVELOPED = 131;
391 enum CMS_F_CMS_GET0_REVOCATION_CHOICES = 132;
392 enum CMS_F_CMS_GET0_SIGNED = 133;
393 enum CMS_F_CMS_MSGSIGDIGEST_ADD1 = 162;
394 enum CMS_F_CMS_RECEIPTREQUEST_CREATE0 = 159;
395 enum CMS_F_CMS_RECEIPT_VERIFY = 160;
396 enum CMS_F_CMS_RECIPIENTINFO_DECRYPT = 134;
397 enum CMS_F_CMS_RECIPIENTINFO_KEKRI_DECRYPT = 135;
398 enum CMS_F_CMS_RECIPIENTINFO_KEKRI_ENCRYPT = 136;
399 enum CMS_F_CMS_RECIPIENTINFO_KEKRI_GET0_ID = 137;
400 enum CMS_F_CMS_RECIPIENTINFO_KEKRI_ID_CMP = 138;
401 enum CMS_F_CMS_RECIPIENTINFO_KTRI_CERT_CMP = 139;
402 enum CMS_F_CMS_RECIPIENTINFO_KTRI_DECRYPT = 140;
403 enum CMS_F_CMS_RECIPIENTINFO_KTRI_ENCRYPT = 141;
404 enum CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_ALGS = 142;
405 enum CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_SIGNER_ID = 143;
406 enum CMS_F_CMS_RECIPIENTINFO_PWRI_CRYPT = 167;
407 enum CMS_F_CMS_RECIPIENTINFO_SET0_KEY = 144;
408 enum CMS_F_CMS_RECIPIENTINFO_SET0_PASSWORD = 168;
409 enum CMS_F_CMS_RECIPIENTINFO_SET0_PKEY = 145;
410 enum CMS_F_CMS_SET1_SIGNERIDENTIFIER = 146;
411 enum CMS_F_CMS_SET_DETACHED = 147;
412 enum CMS_F_CMS_SIGN = 148;
413 enum CMS_F_CMS_SIGNED_DATA_INIT = 149;
414 enum CMS_F_CMS_SIGNERINFO_CONTENT_SIGN = 150;
415 enum CMS_F_CMS_SIGNERINFO_SIGN = 151;
416 enum CMS_F_CMS_SIGNERINFO_VERIFY = 152;
417 enum CMS_F_CMS_SIGNERINFO_VERIFY_CERT = 153;
418 enum CMS_F_CMS_SIGNERINFO_VERIFY_CONTENT = 154;
419 enum CMS_F_CMS_SIGN_RECEIPT = 163;
420 enum CMS_F_CMS_STREAM = 155;
421 enum CMS_F_CMS_UNCOMPRESS = 156;
422 enum CMS_F_CMS_VERIFY = 157;
423 
424 /* Reason codes. */
425 enum CMS_R_ADD_SIGNER_ERROR = 99;
426 enum CMS_R_CERTIFICATE_ALREADY_PRESENT = 175;
427 enum CMS_R_CERTIFICATE_HAS_NO_KEYID = 160;
428 enum CMS_R_CERTIFICATE_VERIFY_ERROR = 100;
429 enum CMS_R_CIPHER_INITIALISATION_ERROR = 101;
430 enum CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR = 102;
431 enum CMS_R_CMS_DATAFINAL_ERROR = 103;
432 enum CMS_R_CMS_LIB = 104;
433 enum CMS_R_CONTENTIDENTIFIER_MISMATCH = 170;
434 enum CMS_R_CONTENT_NOT_FOUND = 105;
435 enum CMS_R_CONTENT_TYPE_MISMATCH = 171;
436 enum CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA = 106;
437 enum CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA = 107;
438 enum CMS_R_CONTENT_TYPE_NOT_SIGNED_DATA = 108;
439 enum CMS_R_CONTENT_VERIFY_ERROR = 109;
440 enum CMS_R_CTRL_ERROR = 110;
441 enum CMS_R_CTRL_FAILURE = 111;
442 enum CMS_R_DECRYPT_ERROR = 112;
443 enum CMS_R_DIGEST_ERROR = 161;
444 enum CMS_R_ERROR_GETTING_PUBLIC_KEY = 113;
445 enum CMS_R_ERROR_READING_MESSAGEDIGEST_ATTRIBUTE = 114;
446 enum CMS_R_ERROR_SETTING_KEY = 115;
447 enum CMS_R_ERROR_SETTING_RECIPIENTINFO = 116;
448 enum CMS_R_INVALID_ENCRYPTED_KEY_LENGTH = 117;
449 enum CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER = 176;
450 enum CMS_R_INVALID_KEY_LENGTH = 118;
451 enum CMS_R_MD_BIO_INIT_ERROR = 119;
452 enum CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH = 120;
453 enum CMS_R_MESSAGEDIGEST_WRONG_LENGTH = 121;
454 enum CMS_R_MSGSIGDIGEST_ERROR = 172;
455 enum CMS_R_MSGSIGDIGEST_VERIFICATION_FAILURE = 162;
456 enum CMS_R_MSGSIGDIGEST_WRONG_LENGTH = 163;
457 enum CMS_R_NEED_ONE_SIGNER = 164;
458 enum CMS_R_NOT_A_SIGNED_RECEIPT = 165;
459 enum CMS_R_NOT_ENCRYPTED_DATA = 122;
460 enum CMS_R_NOT_KEK = 123;
461 enum CMS_R_NOT_KEY_TRANSPORT = 124;
462 enum CMS_R_NOT_PWRI = 177;
463 enum CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE = 125;
464 enum CMS_R_NO_CIPHER = 126;
465 enum CMS_R_NO_CONTENT = 127;
466 enum CMS_R_NO_CONTENT_TYPE = 173;
467 enum CMS_R_NO_DEFAULT_DIGEST = 128;
468 enum CMS_R_NO_DIGEST_SET = 129;
469 enum CMS_R_NO_KEY = 130;
470 enum CMS_R_NO_KEY_OR_CERT = 174;
471 enum CMS_R_NO_MATCHING_DIGEST = 131;
472 enum CMS_R_NO_MATCHING_RECIPIENT = 132;
473 enum CMS_R_NO_MATCHING_SIGNATURE = 166;
474 enum CMS_R_NO_MSGSIGDIGEST = 167;
475 enum CMS_R_NO_PASSWORD = 178;
476 enum CMS_R_NO_PRIVATE_KEY = 133;
477 enum CMS_R_NO_PUBLIC_KEY = 134;
478 enum CMS_R_NO_RECEIPT_REQUEST = 168;
479 enum CMS_R_NO_SIGNERS = 135;
480 enum CMS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE = 136;
481 enum CMS_R_RECEIPT_DECODE_ERROR = 169;
482 enum CMS_R_RECIPIENT_ERROR = 137;
483 enum CMS_R_SIGNER_CERTIFICATE_NOT_FOUND = 138;
484 enum CMS_R_SIGNFINAL_ERROR = 139;
485 enum CMS_R_SMIME_TEXT_ERROR = 140;
486 enum CMS_R_STORE_INIT_ERROR = 141;
487 enum CMS_R_TYPE_NOT_COMPRESSED_DATA = 142;
488 enum CMS_R_TYPE_NOT_DATA = 143;
489 enum CMS_R_TYPE_NOT_DIGESTED_DATA = 144;
490 enum CMS_R_TYPE_NOT_ENCRYPTED_DATA = 145;
491 enum CMS_R_TYPE_NOT_ENVELOPED_DATA = 146;
492 enum CMS_R_UNABLE_TO_FINALIZE_CONTEXT = 147;
493 enum CMS_R_UNKNOWN_CIPHER = 148;
494 enum CMS_R_UNKNOWN_DIGEST_ALGORIHM = 149;
495 enum CMS_R_UNKNOWN_ID = 150;
496 enum CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM = 151;
497 enum CMS_R_UNSUPPORTED_CONTENT_TYPE = 152;
498 enum CMS_R_UNSUPPORTED_KEK_ALGORITHM = 153;
499 enum CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM = 179;
500 enum CMS_R_UNSUPPORTED_RECIPIENT_TYPE = 154;
501 enum CMS_R_UNSUPPORTED_RECPIENTINFO_TYPE = 155;
502 enum CMS_R_UNSUPPORTED_TYPE = 156;
503 enum CMS_R_UNWRAP_ERROR = 157;
504 enum CMS_R_UNWRAP_FAILURE = 180;
505 enum CMS_R_VERIFICATION_FAILURE = 158;
506 enum CMS_R_WRAP_ERROR = 159;