Add suppot for ASCII with CRLF canonicalisation.
[openssl.git] / crypto / cms / cms.h
index c48c82863e97ff87c8c2e3679c54ff4cd26c9c20..0d1649ab21853154af5a23df8889fd457c692864 100644 (file)
@@ -73,9 +73,12 @@ typedef struct CMS_RevocationInfoChoice_st CMS_RevocationInfoChoice;
 typedef struct CMS_RecipientInfo_st CMS_RecipientInfo;
 typedef struct CMS_ReceiptRequest_st CMS_ReceiptRequest;
 typedef struct CMS_Receipt_st CMS_Receipt;
+typedef struct CMS_RecipientEncryptedKey_st CMS_RecipientEncryptedKey;
+typedef struct CMS_OtherKeyAttribute_st CMS_OtherKeyAttribute;
 
 DECLARE_STACK_OF(CMS_SignerInfo)
 DECLARE_STACK_OF(GENERAL_NAMES)
+DECLARE_STACK_OF(CMS_RecipientEncryptedKey)
 DECLARE_ASN1_FUNCTIONS(CMS_ContentInfo)
 DECLARE_ASN1_FUNCTIONS(CMS_ReceiptRequest)
 DECLARE_ASN1_PRINT_FUNCTION(CMS_ContentInfo)
@@ -83,6 +86,7 @@ DECLARE_ASN1_PRINT_FUNCTION(CMS_ContentInfo)
 #define CMS_SIGNERINFO_ISSUER_SERIAL   0
 #define CMS_SIGNERINFO_KEYIDENTIFIER   1
 
+#define CMS_RECIPINFO_NONE             -1
 #define CMS_RECIPINFO_TRANS            0
 #define CMS_RECIPINFO_AGREE            1
 #define CMS_RECIPINFO_KEK              2
@@ -111,6 +115,9 @@ DECLARE_ASN1_PRINT_FUNCTION(CMS_ContentInfo)
 #define CMS_PARTIAL                    0x4000
 #define CMS_REUSE_DIGEST               0x8000
 #define CMS_USE_KEYID                  0x10000
+#define CMS_DEBUG_DECRYPT              0x20000
+#define CMS_KEY_PARAM                  0x40000
+#define CMS_ASCIICRLF                  0x80000
 
 const ASN1_OBJECT *CMS_get0_type(CMS_ContentInfo *cms);
 
@@ -189,6 +196,7 @@ int CMS_decrypt_set1_password(CMS_ContentInfo *cms,
 
 STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms);
 int CMS_RecipientInfo_type(CMS_RecipientInfo *ri);
+EVP_PKEY_CTX *CMS_RecipientInfo_get0_pkey_ctx(CMS_RecipientInfo *ri);
 CMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher);
 CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms,
                                        X509 *recip, unsigned int flags);
@@ -232,6 +240,7 @@ CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms,
                                        const EVP_CIPHER *kekciph);
 
 int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);
+int CMS_RecipientInfo_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);
        
 int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
                                                        unsigned int flags);
@@ -254,6 +263,8 @@ int CMS_SignedData_init(CMS_ContentInfo *cms);
 CMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms,
                        X509 *signer, EVP_PKEY *pk, const EVP_MD *md,
                        unsigned int flags);
+EVP_PKEY_CTX *CMS_SignerInfo_get0_pkey_ctx(CMS_SignerInfo *si);
+EVP_MD_CTX *CMS_SignerInfo_get0_md_ctx(CMS_SignerInfo *si);
 STACK_OF(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo *cms);
 
 void CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer);
@@ -265,6 +276,7 @@ int CMS_set1_signers_certs(CMS_ContentInfo *cms, STACK_OF(X509) *certs,
                                        unsigned int flags);
 void CMS_SignerInfo_get0_algs(CMS_SignerInfo *si, EVP_PKEY **pk, X509 **signer,
                                        X509_ALGOR **pdig, X509_ALGOR **psig);
+ASN1_OCTET_STRING *CMS_SignerInfo_get0_signature(CMS_SignerInfo *si);
 int CMS_SignerInfo_sign(CMS_SignerInfo *si);
 int CMS_SignerInfo_verify(CMS_SignerInfo *si);
 int CMS_SignerInfo_verify_content(CMS_SignerInfo *si, BIO *chain);
@@ -327,8 +339,35 @@ void CMS_ReceiptRequest_get0_values(CMS_ReceiptRequest *rr,
                                        int *pallorfirst,
                                        STACK_OF(GENERAL_NAMES) **plist,
                                        STACK_OF(GENERAL_NAMES) **prto);
-
 #endif
+int CMS_RecipientInfo_kari_get0_alg(CMS_RecipientInfo *ri,
+                                       X509_ALGOR **palg,
+                                       ASN1_OCTET_STRING **pukm);
+STACK_OF(CMS_RecipientEncryptedKey) *
+       CMS_RecipientInfo_kari_get0_reks(CMS_RecipientInfo *ri);
+
+int CMS_RecipientInfo_kari_get0_orig_id(CMS_RecipientInfo *ri,
+                                       X509_ALGOR **pubalg,
+                                       ASN1_BIT_STRING **pubkey,
+                                       ASN1_OCTET_STRING **keyid,
+                                       X509_NAME **issuer, ASN1_INTEGER **sno);
+
+int CMS_RecipientInfo_kari_orig_id_cmp(CMS_RecipientInfo *ri, X509 *cert);
+       
+int CMS_RecipientEncryptedKey_get0_id(CMS_RecipientEncryptedKey *rek,
+                                       ASN1_OCTET_STRING **keyid,
+                                       ASN1_GENERALIZEDTIME **tm,
+                                       CMS_OtherKeyAttribute **other,
+                                       X509_NAME **issuer, ASN1_INTEGER **sno);
+int CMS_RecipientEncryptedKey_cert_cmp(CMS_RecipientEncryptedKey *rek,
+                                               X509 *cert);
+int CMS_RecipientInfo_kari_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pk);
+EVP_CIPHER_CTX *CMS_RecipientInfo_kari_get0_ctx(CMS_RecipientInfo *ri);
+int CMS_RecipientInfo_kari_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri,
+                                       CMS_RecipientEncryptedKey *rek);
+
+int CMS_SharedInfo_encode(unsigned char **pder, X509_ALGOR *kekalg, 
+                       ASN1_OCTET_STRING *ukm, int keylen);
 
 /* BEGIN ERROR CODES */
 /* The following lines are auto generated by the script mkerr.pl. Any changes
@@ -372,6 +411,7 @@ void ERR_load_CMS_strings(void);
 #define CMS_F_CMS_ENVELOPEDDATA_CREATE                  124
 #define CMS_F_CMS_ENVELOPEDDATA_INIT_BIO                125
 #define CMS_F_CMS_ENVELOPED_DATA_INIT                   126
+#define CMS_F_CMS_ENV_ASN1_CTRL                                 171
 #define CMS_F_CMS_FINAL                                         127
 #define CMS_F_CMS_GET0_CERTIFICATE_CHOICES              128
 #define CMS_F_CMS_GET0_CONTENT                          129
@@ -383,6 +423,12 @@ void ERR_load_CMS_strings(void);
 #define CMS_F_CMS_RECEIPTREQUEST_CREATE0                159
 #define CMS_F_CMS_RECEIPT_VERIFY                        160
 #define CMS_F_CMS_RECIPIENTINFO_DECRYPT                         134
+#define CMS_F_CMS_RECIPIENTINFO_ENCRYPT                         169
+#define CMS_F_CMS_RECIPIENTINFO_KARI_ENCRYPT            178
+#define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_ALG           175
+#define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_ORIG_ID       173
+#define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_REKS          172
+#define CMS_F_CMS_RECIPIENTINFO_KARI_ORIG_ID_CMP        174
 #define CMS_F_CMS_RECIPIENTINFO_KEKRI_DECRYPT           135
 #define CMS_F_CMS_RECIPIENTINFO_KEKRI_ENCRYPT           136
 #define CMS_F_CMS_RECIPIENTINFO_KEKRI_GET0_ID           137
@@ -396,6 +442,9 @@ void ERR_load_CMS_strings(void);
 #define CMS_F_CMS_RECIPIENTINFO_SET0_KEY                144
 #define CMS_F_CMS_RECIPIENTINFO_SET0_PASSWORD           168
 #define CMS_F_CMS_RECIPIENTINFO_SET0_PKEY               145
+#define CMS_F_CMS_SD_ASN1_CTRL                          170
+#define CMS_F_CMS_SET1_IAS                              176
+#define CMS_F_CMS_SET1_KEYID                            177
 #define CMS_F_CMS_SET1_SIGNERIDENTIFIER                         146
 #define CMS_F_CMS_SET_DETACHED                          147
 #define CMS_F_CMS_SIGN                                  148
@@ -447,6 +496,7 @@ void ERR_load_CMS_strings(void);
 #define CMS_R_NOT_A_SIGNED_RECEIPT                      165
 #define CMS_R_NOT_ENCRYPTED_DATA                        122
 #define CMS_R_NOT_KEK                                   123
+#define CMS_R_NOT_KEY_AGREEMENT                                 181
 #define CMS_R_NOT_KEY_TRANSPORT                                 124
 #define CMS_R_NOT_PWRI                                  177
 #define CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE           125