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