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