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