RFC 3161 compliant time stamp request creation, response generation
[openssl.git] / crypto / pkcs7 / pkcs7.h
index 2835d58a58172d597770b7368c5e9620c638e2d8..64ce62e673d5edf2bd434b9574f73f324c17feac 100644 (file)
 #ifndef HEADER_PKCS7_H
 #define HEADER_PKCS7_H
 
+#include <openssl/asn1.h>
 #include <openssl/bio.h>
-#include <openssl/x509.h>
+#include <openssl/e_os2.h>
 
 #include <openssl/symhacks.h>
+#include <openssl/ossl_typ.h>
 
 #ifdef  __cplusplus
 extern "C" {
 #endif
 
-#ifdef WIN32
+#ifdef OPENSSL_SYS_WIN32
 /* Under Win32 thes are defined in wincrypt.h */
 #undef PKCS7_ISSUER_AND_SERIAL
 #undef PKCS7_SIGNER_INFO
@@ -230,6 +232,11 @@ DECLARE_PKCS12_STACK_OF(PKCS7)
 #define PKCS7_type_is_signedAndEnveloped(a) \
                (OBJ_obj2nid((a)->type) == NID_pkcs7_signedAndEnveloped)
 #define PKCS7_type_is_data(a)   (OBJ_obj2nid((a)->type) == NID_pkcs7_data)
+#define PKCS7_type_is_digest(a)   (OBJ_obj2nid((a)->type) == NID_pkcs7_digest)
+#define PKCS7_type_is_encrypted(a) \
+               (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted)
+
+#define PKCS7_type_is_digest(a)   (OBJ_obj2nid((a)->type) == NID_pkcs7_digest)
 
 #define PKCS7_set_detached(p,v) \
                PKCS7_ctrl(p,PKCS7_OP_SET_DETACHED_SIGNATURE,v,NULL)
@@ -258,6 +265,10 @@ DECLARE_PKCS12_STACK_OF(PKCS7)
 #define PKCS7_BINARY           0x80
 #define PKCS7_NOATTR           0x100
 #define        PKCS7_NOSMIMECAP        0x200
+#define PKCS7_NOOLDMIMETYPE    0x400
+#define PKCS7_CRLFEOL          0x800
+#define PKCS7_STREAM           0x1000
+#define PKCS7_NOCRL            0x2000
 
 /* Flags: for compatibility with older code */
 
@@ -276,7 +287,7 @@ DECLARE_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SERIAL)
 #ifndef SSLEAY_MACROS
 int PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data,const EVP_MD *type,
        unsigned char *md,unsigned int *len);
-#ifndef NO_FP_API
+#ifndef OPENSSL_NO_FP_API
 PKCS7 *d2i_PKCS7_fp(FILE *fp,PKCS7 **p7);
 int i2d_PKCS7_fp(FILE *fp,PKCS7 *p7);
 #endif
@@ -295,15 +306,19 @@ DECLARE_ASN1_FUNCTIONS(PKCS7_DIGEST)
 DECLARE_ASN1_FUNCTIONS(PKCS7_ENCRYPT)
 DECLARE_ASN1_FUNCTIONS(PKCS7)
 
-void ERR_load_PKCS7_strings(void);
+DECLARE_ASN1_ITEM(PKCS7_ATTR_SIGN)
+DECLARE_ASN1_ITEM(PKCS7_ATTR_VERIFY)
 
+DECLARE_ASN1_NDEF_FUNCTION(PKCS7)
+DECLARE_ASN1_PRINT_FUNCTION(PKCS7)
 
 long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg);
 
 int PKCS7_set_type(PKCS7 *p7, int type);
+int PKCS7_set0_type_other(PKCS7 *p7, int type, ASN1_TYPE *other);
 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);
+       const 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);
@@ -319,8 +334,9 @@ BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert);
 
 
 PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509,
-       EVP_PKEY *pkey, EVP_MD *dgst);
+       EVP_PKEY *pkey, const EVP_MD *dgst);
 X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si);
+int PKCS7_set_digest(PKCS7 *p7, const EVP_MD *md);
 STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7);
 
 PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509);
@@ -346,7 +362,7 @@ PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
 int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
                                        BIO *indata, BIO *out, int flags);
 STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags);
-PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, EVP_CIPHER *cipher,
+PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher,
                                                                int flags);
 int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags);
 
@@ -364,6 +380,7 @@ int SMIME_text(BIO *in, BIO *out);
 /* 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.
  */
+void ERR_load_PKCS7_strings(void);
 
 /* Error codes for the PKCS7 functions. */
 
@@ -375,16 +392,20 @@ int SMIME_text(BIO *in, BIO *out);
 #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_BIO_ADD_DIGEST                    125
 #define PKCS7_F_PKCS7_CTRL                              104
 #define PKCS7_F_PKCS7_DATADECODE                        112
+#define PKCS7_F_PKCS7_DATAFINAL                                 128
 #define PKCS7_F_PKCS7_DATAINIT                          105
 #define PKCS7_F_PKCS7_DATASIGN                          106
 #define PKCS7_F_PKCS7_DATAVERIFY                        107
 #define PKCS7_F_PKCS7_DECRYPT                           114
 #define PKCS7_F_PKCS7_ENCRYPT                           115
+#define PKCS7_F_PKCS7_FIND_DIGEST                       127
 #define PKCS7_F_PKCS7_GET0_SIGNERS                      124
 #define PKCS7_F_PKCS7_SET_CIPHER                        108
 #define PKCS7_F_PKCS7_SET_CONTENT                       109
+#define PKCS7_F_PKCS7_SET_DIGEST                        126
 #define PKCS7_F_PKCS7_SET_TYPE                          110
 #define PKCS7_F_PKCS7_SIGN                              116
 #define PKCS7_F_PKCS7_SIGNATUREVERIFY                   113
@@ -404,7 +425,6 @@ int SMIME_text(BIO *in, BIO *out);
 #define PKCS7_R_DIGEST_FAILURE                          101
 #define PKCS7_R_ERROR_ADDING_RECIPIENT                  120
 #define PKCS7_R_ERROR_SETTING_CIPHER                    121
-#define PKCS7_R_INTERNAL_ERROR                          102
 #define PKCS7_R_INVALID_MIME_TYPE                       131
 #define PKCS7_R_INVALID_NULL_POINTER                    143
 #define PKCS7_R_MIME_NO_CONTENT_TYPE                    132
@@ -416,13 +436,15 @@ int SMIME_text(BIO *in, BIO *out);
 #define PKCS7_R_NO_MULTIPART_BODY_FAILURE               136
 #define PKCS7_R_NO_MULTIPART_BOUNDARY                   137
 #define PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE        115
+#define PKCS7_R_NO_RECIPIENT_MATCHES_KEY                146
 #define PKCS7_R_NO_SIGNATURES_ON_DATA                   123
 #define PKCS7_R_NO_SIGNERS                              142
 #define PKCS7_R_NO_SIG_CONTENT_TYPE                     138
 #define PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE    104
 #define PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR               124
+#define PKCS7_R_PKCS7_DATAFINAL                                 126
 #define PKCS7_R_PKCS7_DATAFINAL_ERROR                   125
-#define PKCS7_R_PKCS7_DATASIGN                          126
+#define PKCS7_R_PKCS7_DATASIGN                          145
 #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
@@ -444,4 +466,3 @@ int SMIME_text(BIO *in, BIO *out);
 }
 #endif
 #endif
-