1998-12-21 18:52:47 +08:00
|
|
|
/* crypto/pkcs7/pkcs7.h */
|
1998-12-21 18:56:39 +08:00
|
|
|
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
1998-12-21 18:52:47 +08:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This package is an SSL implementation written
|
|
|
|
* by Eric Young (eay@cryptsoft.com).
|
|
|
|
* The implementation was written so as to conform with Netscapes SSL.
|
|
|
|
*
|
|
|
|
* This library is free for commercial and non-commercial use as long as
|
|
|
|
* the following conditions are aheared to. The following conditions
|
|
|
|
* apply to all code found in this distribution, be it the RC4, RSA,
|
|
|
|
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
|
|
|
* included with this distribution is covered by the same copyright terms
|
|
|
|
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
|
|
|
*
|
|
|
|
* Copyright remains Eric Young's, and as such any Copyright notices in
|
|
|
|
* the code are not to be removed.
|
|
|
|
* If this package is used in a product, Eric Young should be given attribution
|
|
|
|
* as the author of the parts of the library used.
|
|
|
|
* This can be in the form of a textual message at program startup or
|
|
|
|
* in documentation (online or textual) provided with the package.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* "This product includes cryptographic software written by
|
|
|
|
* Eric Young (eay@cryptsoft.com)"
|
|
|
|
* The word 'cryptographic' can be left out if the rouines from the library
|
|
|
|
* being used are not cryptographic related :-).
|
|
|
|
* 4. If you include any Windows specific code (or a derivative thereof) from
|
|
|
|
* the apps directory (application code) you must include an acknowledgement:
|
|
|
|
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* The licence and distribution terms for any publically available version or
|
|
|
|
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
|
|
|
* copied and put under another distribution licence
|
|
|
|
* [including the GNU Public Licence.]
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HEADER_PKCS7_H
|
|
|
|
#define HEADER_PKCS7_H
|
|
|
|
|
1999-04-24 06:13:45 +08:00
|
|
|
#include <openssl/bio.h>
|
|
|
|
#include <openssl/x509.h>
|
1998-12-21 18:52:47 +08:00
|
|
|
|
2000-09-08 14:28:09 +08:00
|
|
|
#include <openssl/symhacks.h>
|
1999-07-29 07:25:59 +08:00
|
|
|
|
2000-05-02 20:16:01 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
1999-05-21 20:14:35 +08:00
|
|
|
#ifdef WIN32
|
2000-01-07 10:23:42 +08:00
|
|
|
/* Under Win32 thes are defined in wincrypt.h */
|
1999-05-21 20:14:35 +08:00
|
|
|
#undef PKCS7_ISSUER_AND_SERIAL
|
2000-01-07 10:23:42 +08:00
|
|
|
#undef PKCS7_SIGNER_INFO
|
1999-05-21 20:14:35 +08:00
|
|
|
#endif
|
|
|
|
|
1998-12-21 18:52:47 +08:00
|
|
|
/*
|
|
|
|
Encryption_ID DES-CBC
|
|
|
|
Digest_ID MD5
|
|
|
|
Digest_Encryption_ID rsaEncryption
|
|
|
|
Key_Encryption_ID rsaEncryption
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct pkcs7_issuer_and_serial_st
|
|
|
|
{
|
|
|
|
X509_NAME *issuer;
|
|
|
|
ASN1_INTEGER *serial;
|
|
|
|
} PKCS7_ISSUER_AND_SERIAL;
|
|
|
|
|
|
|
|
typedef struct pkcs7_signer_info_st
|
|
|
|
{
|
|
|
|
ASN1_INTEGER *version; /* version 1 */
|
|
|
|
PKCS7_ISSUER_AND_SERIAL *issuer_and_serial;
|
|
|
|
X509_ALGOR *digest_alg;
|
1999-05-31 19:57:32 +08:00
|
|
|
STACK_OF(X509_ATTRIBUTE) *auth_attr; /* [ 0 ] */
|
1998-12-21 18:52:47 +08:00
|
|
|
X509_ALGOR *digest_enc_alg;
|
|
|
|
ASN1_OCTET_STRING *enc_digest;
|
1999-05-31 19:57:32 +08:00
|
|
|
STACK_OF(X509_ATTRIBUTE) *unauth_attr; /* [ 1 ] */
|
1998-12-21 18:52:47 +08:00
|
|
|
|
|
|
|
/* The private key to sign with */
|
|
|
|
EVP_PKEY *pkey;
|
|
|
|
} PKCS7_SIGNER_INFO;
|
|
|
|
|
1999-06-03 01:11:53 +08:00
|
|
|
DECLARE_STACK_OF(PKCS7_SIGNER_INFO)
|
|
|
|
DECLARE_ASN1_SET_OF(PKCS7_SIGNER_INFO)
|
|
|
|
|
1998-12-21 18:52:47 +08:00
|
|
|
typedef struct pkcs7_recip_info_st
|
|
|
|
{
|
|
|
|
ASN1_INTEGER *version; /* version 0 */
|
|
|
|
PKCS7_ISSUER_AND_SERIAL *issuer_and_serial;
|
|
|
|
X509_ALGOR *key_enc_algor;
|
|
|
|
ASN1_OCTET_STRING *enc_key;
|
1998-12-21 18:56:39 +08:00
|
|
|
X509 *cert; /* get the pub-key from this */
|
1998-12-21 18:52:47 +08:00
|
|
|
} PKCS7_RECIP_INFO;
|
|
|
|
|
1999-06-03 05:13:45 +08:00
|
|
|
DECLARE_STACK_OF(PKCS7_RECIP_INFO)
|
|
|
|
DECLARE_ASN1_SET_OF(PKCS7_RECIP_INFO)
|
|
|
|
|
1998-12-21 18:52:47 +08:00
|
|
|
typedef struct pkcs7_signed_st
|
|
|
|
{
|
|
|
|
ASN1_INTEGER *version; /* version 1 */
|
1999-06-01 04:35:31 +08:00
|
|
|
STACK_OF(X509_ALGOR) *md_algs; /* md used */
|
1999-04-13 01:23:57 +08:00
|
|
|
STACK_OF(X509) *cert; /* [ 0 ] */
|
1999-06-01 05:00:25 +08:00
|
|
|
STACK_OF(X509_CRL) *crl; /* [ 1 ] */
|
1999-06-03 01:11:53 +08:00
|
|
|
STACK_OF(PKCS7_SIGNER_INFO) *signer_info;
|
1998-12-21 18:56:39 +08:00
|
|
|
|
|
|
|
struct pkcs7_st *contents;
|
1998-12-21 18:52:47 +08:00
|
|
|
} PKCS7_SIGNED;
|
|
|
|
/* The above structure is very very similar to PKCS7_SIGN_ENVELOPE.
|
|
|
|
* How about merging the two */
|
|
|
|
|
|
|
|
typedef struct pkcs7_enc_content_st
|
|
|
|
{
|
|
|
|
ASN1_OBJECT *content_type;
|
|
|
|
X509_ALGOR *algorithm;
|
|
|
|
ASN1_OCTET_STRING *enc_data; /* [ 0 ] */
|
1999-05-16 08:25:36 +08:00
|
|
|
const EVP_CIPHER *cipher;
|
1998-12-21 18:52:47 +08:00
|
|
|
} PKCS7_ENC_CONTENT;
|
|
|
|
|
|
|
|
typedef struct pkcs7_enveloped_st
|
|
|
|
{
|
|
|
|
ASN1_INTEGER *version; /* version 0 */
|
1999-06-03 05:13:45 +08:00
|
|
|
STACK_OF(PKCS7_RECIP_INFO) *recipientinfo;
|
1998-12-21 18:52:47 +08:00
|
|
|
PKCS7_ENC_CONTENT *enc_data;
|
|
|
|
} PKCS7_ENVELOPE;
|
1999-05-16 08:25:36 +08:00
|
|
|
|
1998-12-21 18:52:47 +08:00
|
|
|
typedef struct pkcs7_signedandenveloped_st
|
|
|
|
{
|
|
|
|
ASN1_INTEGER *version; /* version 1 */
|
1999-06-01 04:35:31 +08:00
|
|
|
STACK_OF(X509_ALGOR) *md_algs; /* md used */
|
1999-04-13 01:23:57 +08:00
|
|
|
STACK_OF(X509) *cert; /* [ 0 ] */
|
1999-06-01 05:00:25 +08:00
|
|
|
STACK_OF(X509_CRL) *crl; /* [ 1 ] */
|
1999-06-03 01:11:53 +08:00
|
|
|
STACK_OF(PKCS7_SIGNER_INFO) *signer_info;
|
1998-12-21 18:56:39 +08:00
|
|
|
|
|
|
|
PKCS7_ENC_CONTENT *enc_data;
|
1999-06-03 05:13:45 +08:00
|
|
|
STACK_OF(PKCS7_RECIP_INFO) *recipientinfo;
|
1998-12-21 18:52:47 +08:00
|
|
|
} PKCS7_SIGN_ENVELOPE;
|
|
|
|
|
|
|
|
typedef struct pkcs7_digest_st
|
|
|
|
{
|
|
|
|
ASN1_INTEGER *version; /* version 0 */
|
|
|
|
X509_ALGOR *md; /* md used */
|
|
|
|
struct pkcs7_st *contents;
|
|
|
|
ASN1_OCTET_STRING *digest;
|
|
|
|
} PKCS7_DIGEST;
|
|
|
|
|
|
|
|
typedef struct pkcs7_encrypted_st
|
|
|
|
{
|
|
|
|
ASN1_INTEGER *version; /* version 0 */
|
|
|
|
PKCS7_ENC_CONTENT *enc_data;
|
|
|
|
} PKCS7_ENCRYPT;
|
|
|
|
|
|
|
|
typedef struct pkcs7_st
|
|
|
|
{
|
|
|
|
/* The following is non NULL if it contains ASN1 encoding of
|
|
|
|
* this structure */
|
|
|
|
unsigned char *asn1;
|
|
|
|
long length;
|
|
|
|
|
|
|
|
#define PKCS7_S_HEADER 0
|
|
|
|
#define PKCS7_S_BODY 1
|
|
|
|
#define PKCS7_S_TAIL 2
|
|
|
|
int state; /* used during processing */
|
|
|
|
|
|
|
|
int detached;
|
|
|
|
|
|
|
|
ASN1_OBJECT *type;
|
|
|
|
/* content as defined by the type */
|
|
|
|
/* all encryption/message digests are applied to the 'contents',
|
|
|
|
* leaving out the 'type' field. */
|
|
|
|
union {
|
|
|
|
char *ptr;
|
|
|
|
|
|
|
|
/* NID_pkcs7_data */
|
|
|
|
ASN1_OCTET_STRING *data;
|
|
|
|
|
|
|
|
/* NID_pkcs7_signed */
|
|
|
|
PKCS7_SIGNED *sign;
|
|
|
|
|
|
|
|
/* NID_pkcs7_enveloped */
|
|
|
|
PKCS7_ENVELOPE *enveloped;
|
|
|
|
|
|
|
|
/* NID_pkcs7_signedAndEnveloped */
|
|
|
|
PKCS7_SIGN_ENVELOPE *signed_and_enveloped;
|
|
|
|
|
|
|
|
/* NID_pkcs7_digest */
|
|
|
|
PKCS7_DIGEST *digest;
|
|
|
|
|
|
|
|
/* NID_pkcs7_encrypted */
|
|
|
|
PKCS7_ENCRYPT *encrypted;
|
2000-08-23 06:20:25 +08:00
|
|
|
|
|
|
|
/* Anything else */
|
|
|
|
ASN1_TYPE *other;
|
1998-12-21 18:52:47 +08:00
|
|
|
} d;
|
|
|
|
} PKCS7;
|
|
|
|
|
2000-05-17 05:22:45 +08:00
|
|
|
DECLARE_STACK_OF(PKCS7)
|
|
|
|
DECLARE_ASN1_SET_OF(PKCS7)
|
|
|
|
DECLARE_PKCS12_STACK_OF(PKCS7)
|
|
|
|
|
1998-12-21 18:52:47 +08:00
|
|
|
#define PKCS7_OP_SET_DETACHED_SIGNATURE 1
|
|
|
|
#define PKCS7_OP_GET_DETACHED_SIGNATURE 2
|
|
|
|
|
1998-12-21 19:00:56 +08:00
|
|
|
#define PKCS7_get_signed_attributes(si) ((si)->auth_attr)
|
|
|
|
#define PKCS7_get_attributes(si) ((si)->unauth_attr)
|
|
|
|
|
1998-12-21 18:52:47 +08:00
|
|
|
#define PKCS7_type_is_signed(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_signed)
|
2000-12-31 09:13:04 +08:00
|
|
|
#define PKCS7_type_is_encrypted(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted)
|
1999-12-05 08:40:59 +08:00
|
|
|
#define PKCS7_type_is_enveloped(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_enveloped)
|
1998-12-21 19:00:56 +08:00
|
|
|
#define PKCS7_type_is_signedAndEnveloped(a) \
|
|
|
|
(OBJ_obj2nid((a)->type) == NID_pkcs7_signedAndEnveloped)
|
1998-12-21 18:52:47 +08:00
|
|
|
#define PKCS7_type_is_data(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_data)
|
|
|
|
|
|
|
|
#define PKCS7_set_detached(p,v) \
|
|
|
|
PKCS7_ctrl(p,PKCS7_OP_SET_DETACHED_SIGNATURE,v,NULL)
|
|
|
|
#define PKCS7_get_detached(p) \
|
|
|
|
PKCS7_ctrl(p,PKCS7_OP_GET_DETACHED_SIGNATURE,0,NULL)
|
|
|
|
|
2000-12-09 03:09:35 +08:00
|
|
|
#define PKCS7_is_detached(p7) (PKCS7_type_is_signed(p7) && PKCS7_get_detached(p7))
|
|
|
|
|
1998-12-21 18:56:39 +08:00
|
|
|
#ifdef SSLEAY_MACROS
|
1998-12-21 19:00:56 +08:00
|
|
|
#ifndef PKCS7_ISSUER_AND_SERIAL_digest
|
1998-12-21 18:56:39 +08:00
|
|
|
#define PKCS7_ISSUER_AND_SERIAL_digest(data,type,md,len) \
|
|
|
|
ASN1_digest((int (*)())i2d_PKCS7_ISSUER_AND_SERIAL,type,\
|
|
|
|
(char *)data,md,len)
|
|
|
|
#endif
|
1998-12-21 19:00:56 +08:00
|
|
|
#endif
|
1998-12-21 18:56:39 +08:00
|
|
|
|
1999-12-05 08:40:59 +08:00
|
|
|
/* S/MIME related flags */
|
|
|
|
|
2000-09-05 21:27:57 +08:00
|
|
|
#define PKCS7_TEXT 0x1
|
|
|
|
#define PKCS7_NOCERTS 0x2
|
|
|
|
#define PKCS7_NOSIGS 0x4
|
|
|
|
#define PKCS7_NOCHAIN 0x8
|
|
|
|
#define PKCS7_NOINTERN 0x10
|
|
|
|
#define PKCS7_NOVERIFY 0x20
|
|
|
|
#define PKCS7_DETACHED 0x40
|
|
|
|
#define PKCS7_BINARY 0x80
|
|
|
|
#define PKCS7_NOATTR 0x100
|
|
|
|
#define PKCS7_NOSMIMECAP 0x200
|
1999-12-05 08:40:59 +08:00
|
|
|
|
2000-02-04 07:23:24 +08:00
|
|
|
/* Flags: for compatibility with older code */
|
1999-12-05 08:40:59 +08:00
|
|
|
|
|
|
|
#define SMIME_TEXT PKCS7_TEXT
|
|
|
|
#define SMIME_NOCERTS PKCS7_NOCERTS
|
|
|
|
#define SMIME_NOSIGS PKCS7_NOSIGS
|
|
|
|
#define SMIME_NOCHAIN PKCS7_NOCHAIN
|
|
|
|
#define SMIME_NOINTERN PKCS7_NOINTERN
|
|
|
|
#define SMIME_NOVERIFY PKCS7_NOVERIFY
|
|
|
|
#define SMIME_DETACHED PKCS7_DETACHED
|
|
|
|
#define SMIME_BINARY PKCS7_BINARY
|
|
|
|
#define SMIME_NOATTR PKCS7_NOATTR
|
1998-12-21 18:56:39 +08:00
|
|
|
|
2000-12-09 03:09:35 +08:00
|
|
|
DECLARE_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SERIAL)
|
1998-12-21 18:52:47 +08:00
|
|
|
|
1998-12-21 18:56:39 +08:00
|
|
|
#ifndef SSLEAY_MACROS
|
1999-11-27 09:14:04 +08:00
|
|
|
int PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data,const EVP_MD *type,
|
1998-12-21 18:52:47 +08:00
|
|
|
unsigned char *md,unsigned int *len);
|
1998-12-21 18:56:39 +08:00
|
|
|
#ifndef NO_FP_API
|
1999-05-21 09:06:23 +08:00
|
|
|
PKCS7 *d2i_PKCS7_fp(FILE *fp,PKCS7 **p7);
|
1998-12-21 18:56:39 +08:00
|
|
|
int i2d_PKCS7_fp(FILE *fp,PKCS7 *p7);
|
|
|
|
#endif
|
|
|
|
PKCS7 *PKCS7_dup(PKCS7 *p7);
|
1999-05-21 09:06:23 +08:00
|
|
|
PKCS7 *d2i_PKCS7_bio(BIO *bp,PKCS7 **p7);
|
1998-12-21 18:56:39 +08:00
|
|
|
int i2d_PKCS7_bio(BIO *bp,PKCS7 *p7);
|
|
|
|
#endif
|
1998-12-21 18:52:47 +08:00
|
|
|
|
2000-12-09 03:09:35 +08:00
|
|
|
DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNER_INFO)
|
|
|
|
DECLARE_ASN1_FUNCTIONS(PKCS7_RECIP_INFO)
|
|
|
|
DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNED)
|
|
|
|
DECLARE_ASN1_FUNCTIONS(PKCS7_ENC_CONTENT)
|
|
|
|
DECLARE_ASN1_FUNCTIONS(PKCS7_ENVELOPE)
|
|
|
|
DECLARE_ASN1_FUNCTIONS(PKCS7_SIGN_ENVELOPE)
|
|
|
|
DECLARE_ASN1_FUNCTIONS(PKCS7_DIGEST)
|
|
|
|
DECLARE_ASN1_FUNCTIONS(PKCS7_ENCRYPT)
|
|
|
|
DECLARE_ASN1_FUNCTIONS(PKCS7)
|
1998-12-21 18:52:47 +08:00
|
|
|
|
|
|
|
void ERR_load_PKCS7_strings(void);
|
|
|
|
|
|
|
|
|
|
|
|
long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg);
|
|
|
|
|
|
|
|
int PKCS7_set_type(PKCS7 *p7, int type);
|
|
|
|
int PKCS7_set_content(PKCS7 *p7, PKCS7 *p7_data);
|
|
|
|
int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey,
|
|
|
|
EVP_MD *dgst);
|
|
|
|
int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *p7i);
|
|
|
|
int PKCS7_add_certificate(PKCS7 *p7, X509 *x509);
|
|
|
|
int PKCS7_add_crl(PKCS7 *p7, X509_CRL *x509);
|
|
|
|
int PKCS7_content_new(PKCS7 *p7, int nid);
|
|
|
|
int PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx,
|
|
|
|
BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si);
|
1999-06-22 21:33:22 +08:00
|
|
|
int PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si,
|
|
|
|
X509 *x509);
|
1998-12-21 18:52:47 +08:00
|
|
|
|
|
|
|
BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio);
|
1998-12-21 19:00:56 +08:00
|
|
|
int PKCS7_dataFinal(PKCS7 *p7, BIO *bio);
|
1999-05-16 08:25:36 +08:00
|
|
|
BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert);
|
1998-12-21 19:00:56 +08:00
|
|
|
|
1998-12-21 18:52:47 +08:00
|
|
|
|
|
|
|
PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509,
|
|
|
|
EVP_PKEY *pkey, EVP_MD *dgst);
|
|
|
|
X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si);
|
1999-06-03 01:11:53 +08:00
|
|
|
STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7);
|
1998-12-21 18:52:47 +08:00
|
|
|
|
1998-12-21 18:56:39 +08:00
|
|
|
PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509);
|
|
|
|
int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri);
|
|
|
|
int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509);
|
1999-05-16 08:25:36 +08:00
|
|
|
int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher);
|
1998-12-21 18:56:39 +08:00
|
|
|
|
1998-12-21 19:00:56 +08:00
|
|
|
PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx);
|
1999-05-31 19:57:32 +08:00
|
|
|
ASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk);
|
1998-12-21 19:00:56 +08:00
|
|
|
int PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si,int nid,int type,
|
1999-05-10 00:39:11 +08:00
|
|
|
void *data);
|
1998-12-21 19:00:56 +08:00
|
|
|
int PKCS7_add_attribute (PKCS7_SIGNER_INFO *p7si, int nid, int atrtype,
|
1999-05-10 00:39:11 +08:00
|
|
|
void *value);
|
1998-12-21 19:00:56 +08:00
|
|
|
ASN1_TYPE *PKCS7_get_attribute(PKCS7_SIGNER_INFO *si, int nid);
|
|
|
|
ASN1_TYPE *PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid);
|
1999-05-31 19:57:32 +08:00
|
|
|
int PKCS7_set_signed_attributes(PKCS7_SIGNER_INFO *p7si,
|
|
|
|
STACK_OF(X509_ATTRIBUTE) *sk);
|
|
|
|
int PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si,STACK_OF(X509_ATTRIBUTE) *sk);
|
1998-12-21 18:56:39 +08:00
|
|
|
|
|
|
|
|
1999-12-05 08:40:59 +08:00
|
|
|
PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
|
|
|
|
BIO *data, int flags);
|
|
|
|
int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
|
|
|
|
BIO *indata, BIO *out, int flags);
|
2000-02-26 09:55:33 +08:00
|
|
|
STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags);
|
1999-12-05 08:40:59 +08:00
|
|
|
PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, EVP_CIPHER *cipher,
|
|
|
|
int flags);
|
|
|
|
int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags);
|
|
|
|
|
2000-05-17 07:01:19 +08:00
|
|
|
int PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si,
|
|
|
|
STACK_OF(X509_ALGOR) *cap);
|
2000-05-21 23:21:55 +08:00
|
|
|
STACK_OF(X509_ALGOR) *PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si);
|
2000-05-17 07:01:19 +08:00
|
|
|
int PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg);
|
1999-12-05 08:40:59 +08:00
|
|
|
|
|
|
|
int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags);
|
|
|
|
PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont);
|
|
|
|
int SMIME_crlf_copy(BIO *in, BIO *out, int flags);
|
|
|
|
int SMIME_text(BIO *in, BIO *out);
|
1998-12-21 19:00:56 +08:00
|
|
|
|
1998-12-21 18:52:47 +08:00
|
|
|
/* BEGIN ERROR CODES */
|
1999-04-24 08:15:18 +08:00
|
|
|
/* The following lines are auto generated by the script mkerr.pl. Any changes
|
|
|
|
* made after this point may be overwritten when the script is next run.
|
|
|
|
*/
|
|
|
|
|
1998-12-21 18:52:47 +08:00
|
|
|
/* Error codes for the PKCS7 functions. */
|
|
|
|
|
|
|
|
/* Function codes. */
|
1999-12-05 08:40:59 +08:00
|
|
|
#define PKCS7_F_B64_READ_PKCS7 120
|
|
|
|
#define PKCS7_F_B64_WRITE_PKCS7 121
|
|
|
|
#define PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP 118
|
1998-12-21 18:56:39 +08:00
|
|
|
#define PKCS7_F_PKCS7_ADD_CERTIFICATE 100
|
|
|
|
#define PKCS7_F_PKCS7_ADD_CRL 101
|
|
|
|
#define PKCS7_F_PKCS7_ADD_RECIPIENT_INFO 102
|
|
|
|
#define PKCS7_F_PKCS7_ADD_SIGNER 103
|
|
|
|
#define PKCS7_F_PKCS7_CTRL 104
|
1999-05-16 08:25:36 +08:00
|
|
|
#define PKCS7_F_PKCS7_DATADECODE 112
|
1998-12-21 18:56:39 +08:00
|
|
|
#define PKCS7_F_PKCS7_DATAINIT 105
|
|
|
|
#define PKCS7_F_PKCS7_DATASIGN 106
|
|
|
|
#define PKCS7_F_PKCS7_DATAVERIFY 107
|
1999-12-05 08:40:59 +08:00
|
|
|
#define PKCS7_F_PKCS7_DECRYPT 114
|
|
|
|
#define PKCS7_F_PKCS7_ENCRYPT 115
|
2000-02-26 09:55:33 +08:00
|
|
|
#define PKCS7_F_PKCS7_GET0_SIGNERS 124
|
1998-12-21 18:56:39 +08:00
|
|
|
#define PKCS7_F_PKCS7_SET_CIPHER 108
|
|
|
|
#define PKCS7_F_PKCS7_SET_CONTENT 109
|
|
|
|
#define PKCS7_F_PKCS7_SET_TYPE 110
|
1999-12-05 08:40:59 +08:00
|
|
|
#define PKCS7_F_PKCS7_SIGN 116
|
1999-06-22 21:33:22 +08:00
|
|
|
#define PKCS7_F_PKCS7_SIGNATUREVERIFY 113
|
1999-12-05 08:40:59 +08:00
|
|
|
#define PKCS7_F_PKCS7_SIMPLE_SMIMECAP 119
|
|
|
|
#define PKCS7_F_PKCS7_VERIFY 117
|
|
|
|
#define PKCS7_F_SMIME_READ_PKCS7 122
|
|
|
|
#define PKCS7_F_SMIME_TEXT 123
|
1998-12-21 18:52:47 +08:00
|
|
|
|
|
|
|
/* Reason codes. */
|
1999-12-05 08:40:59 +08:00
|
|
|
#define PKCS7_R_CERTIFICATE_VERIFY_ERROR 117
|
1999-12-29 10:59:18 +08:00
|
|
|
#define PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 144
|
1999-05-16 08:25:36 +08:00
|
|
|
#define PKCS7_R_CIPHER_NOT_INITIALIZED 116
|
1999-12-05 08:40:59 +08:00
|
|
|
#define PKCS7_R_CONTENT_AND_DATA_PRESENT 118
|
|
|
|
#define PKCS7_R_DECODE_ERROR 130
|
1998-12-21 19:00:56 +08:00
|
|
|
#define PKCS7_R_DECRYPTED_KEY_IS_WRONG_LENGTH 100
|
1999-12-05 08:40:59 +08:00
|
|
|
#define PKCS7_R_DECRYPT_ERROR 119
|
1998-12-21 19:00:56 +08:00
|
|
|
#define PKCS7_R_DIGEST_FAILURE 101
|
1999-12-05 08:40:59 +08:00
|
|
|
#define PKCS7_R_ERROR_ADDING_RECIPIENT 120
|
|
|
|
#define PKCS7_R_ERROR_SETTING_CIPHER 121
|
1998-12-21 19:00:56 +08:00
|
|
|
#define PKCS7_R_INTERNAL_ERROR 102
|
1999-12-05 08:40:59 +08:00
|
|
|
#define PKCS7_R_INVALID_MIME_TYPE 131
|
1999-12-09 09:31:32 +08:00
|
|
|
#define PKCS7_R_INVALID_NULL_POINTER 143
|
1999-12-05 08:40:59 +08:00
|
|
|
#define PKCS7_R_MIME_NO_CONTENT_TYPE 132
|
|
|
|
#define PKCS7_R_MIME_PARSE_ERROR 133
|
|
|
|
#define PKCS7_R_MIME_SIG_PARSE_ERROR 134
|
1998-12-21 19:00:56 +08:00
|
|
|
#define PKCS7_R_MISSING_CERIPEND_INFO 103
|
1999-12-05 08:40:59 +08:00
|
|
|
#define PKCS7_R_NO_CONTENT 122
|
|
|
|
#define PKCS7_R_NO_CONTENT_TYPE 135
|
|
|
|
#define PKCS7_R_NO_MULTIPART_BODY_FAILURE 136
|
|
|
|
#define PKCS7_R_NO_MULTIPART_BOUNDARY 137
|
1999-05-16 08:25:36 +08:00
|
|
|
#define PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE 115
|
1999-12-05 08:40:59 +08:00
|
|
|
#define PKCS7_R_NO_SIGNATURES_ON_DATA 123
|
1999-12-07 10:35:52 +08:00
|
|
|
#define PKCS7_R_NO_SIGNERS 142
|
1999-12-05 08:40:59 +08:00
|
|
|
#define PKCS7_R_NO_SIG_CONTENT_TYPE 138
|
1998-12-21 19:00:56 +08:00
|
|
|
#define PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE 104
|
1999-12-05 08:40:59 +08:00
|
|
|
#define PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR 124
|
|
|
|
#define PKCS7_R_PKCS7_DATAFINAL_ERROR 125
|
|
|
|
#define PKCS7_R_PKCS7_DATASIGN 126
|
|
|
|
#define PKCS7_R_PKCS7_PARSE_ERROR 139
|
|
|
|
#define PKCS7_R_PKCS7_SIG_PARSE_ERROR 140
|
|
|
|
#define PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 127
|
1998-12-21 19:00:56 +08:00
|
|
|
#define PKCS7_R_SIGNATURE_FAILURE 105
|
1999-12-05 08:40:59 +08:00
|
|
|
#define PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND 128
|
|
|
|
#define PKCS7_R_SIG_INVALID_MIME_TYPE 141
|
|
|
|
#define PKCS7_R_SMIME_TEXT_ERROR 129
|
1998-12-21 19:00:56 +08:00
|
|
|
#define PKCS7_R_UNABLE_TO_FIND_CERTIFICATE 106
|
|
|
|
#define PKCS7_R_UNABLE_TO_FIND_MEM_BIO 107
|
|
|
|
#define PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST 108
|
|
|
|
#define PKCS7_R_UNKNOWN_DIGEST_TYPE 109
|
|
|
|
#define PKCS7_R_UNKNOWN_OPERATION 110
|
|
|
|
#define PKCS7_R_UNSUPPORTED_CIPHER_TYPE 111
|
|
|
|
#define PKCS7_R_UNSUPPORTED_CONTENT_TYPE 112
|
|
|
|
#define PKCS7_R_WRONG_CONTENT_TYPE 113
|
|
|
|
#define PKCS7_R_WRONG_PKCS7_TYPE 114
|
1999-04-24 08:15:18 +08:00
|
|
|
|
1998-12-21 18:52:47 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|