Add support for KEKRecipientInfo in cms application.
[openssl.git] / crypto / cms / cms.h
index 41f0e86..5a74c4b 100644 (file)
@@ -109,7 +109,6 @@ DECLARE_ASN1_PRINT_FUNCTION(CMS_ContentInfo)
 #define CMS_USE_KEYID                  0x10000
 
 const ASN1_OBJECT *CMS_get0_type(CMS_ContentInfo *cms);
-CMS_ContentInfo *CMS_Data_Create(void);
 
 BIO *CMS_dataInit(CMS_ContentInfo *cms, BIO *icont);
 int CMS_dataFinal(CMS_ContentInfo *cms, BIO *bio);
@@ -170,6 +169,10 @@ int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pkey, X509 *cert,
 
 STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms);
 int CMS_RecipientInfo_type(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);
+int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey);
 int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert);
 int CMS_RecipientInfo_ktri_get0_algs(CMS_RecipientInfo *ri,
                                        EVP_PKEY **pk, X509 **recip,
@@ -178,8 +181,14 @@ int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri,
                                        ASN1_OCTET_STRING **keyid,
                                        X509_NAME **issuer, ASN1_INTEGER **sno);
 
-int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri,
-                              EVP_PKEY *pkey);
+CMS_RecipientInfo *CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid,
+                                       unsigned char *key, size_t keylen,
+                                       unsigned char *id, size_t idlen,
+                                       ASN1_GENERALIZEDTIME *date,
+                                       ASN1_OBJECT *otherTypeId,
+                                       ASN1_TYPE *otherType);
+       
+int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);
        
 int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
                                                        unsigned int flags);
@@ -271,6 +280,7 @@ void ERR_load_CMS_strings(void);
 
 /* Function codes. */
 #define CMS_F_CHECK_CONTENT                             151
+#define CMS_F_CMS_ADD0_RECIPIENT_KEY                    157
 #define CMS_F_CMS_ADD1_RECIPIENT_CERT                   99
 #define CMS_F_CMS_ADD1_SIGNER                           100
 #define CMS_F_CMS_ADD1_SIGNINGTIME                      101
@@ -291,6 +301,7 @@ void ERR_load_CMS_strings(void);
 #define CMS_F_CMS_DIGESTALGORITHM_INIT_BIO              111
 #define CMS_F_CMS_DIGESTEDDATA_DO_FINAL                         112
 #define CMS_F_CMS_DIGEST_VERIFY                                 113
+#define CMS_F_CMS_ENCRYPT                               154
 #define CMS_F_CMS_ENCRYPTEDCONTENT_DECRYPT_BIO          146
 #define CMS_F_CMS_ENCRYPTEDCONTENT_ENCRYPT_BIO          144
 #define CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO             148
@@ -300,6 +311,8 @@ void ERR_load_CMS_strings(void);
 #define CMS_F_CMS_ENCRYPTEDDATA_INIT_BIO                147
 #define CMS_F_CMS_ENCRYPTEDDATA_SET1_KEY                141
 #define CMS_F_CMS_ENCRYPTED_DATA_DECRYPT                139
+#define CMS_F_CMS_ENVELOPEDDATA_CREATE                  153
+#define CMS_F_CMS_ENVELOPEDDATA_INIT_BIO                156
 #define CMS_F_CMS_ENVELOPED_DATA_INIT                   114
 #define CMS_F_CMS_FINAL                                         115
 #define CMS_F_CMS_GET0_CERTIFICATE_CHOICES              116
@@ -309,9 +322,16 @@ void ERR_load_CMS_strings(void);
 #define CMS_F_CMS_GET0_REVOCATION_CHOICES               120
 #define CMS_F_CMS_GET0_SIGNED                           121
 #define CMS_F_CMS_RECIPIENTINFO_DECRYPT                         150
+#define CMS_F_CMS_RECIPIENTINFO_KEKRI_DECRYPT           161
+#define CMS_F_CMS_RECIPIENTINFO_KEKRI_ENCRYPT           162
+#define CMS_F_CMS_RECIPIENTINFO_KEKRI_GET0_ID           158
 #define CMS_F_CMS_RECIPIENTINFO_KTRI_CERT_CMP           122
+#define CMS_F_CMS_RECIPIENTINFO_KTRI_DECRYPT            160
+#define CMS_F_CMS_RECIPIENTINFO_KTRI_ENCRYPT            155
 #define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_ALGS          123
 #define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_SIGNER_ID     124
+#define CMS_F_CMS_RECIPIENTINFO_SET0_KEY                163
+#define CMS_F_CMS_RECIPIENTINFO_SET0_PKEY               159
 #define CMS_F_CMS_SET1_SIGNERIDENTIFIER                         125
 #define CMS_F_CMS_SET_DETACHED                          126
 #define CMS_F_CMS_SIGN                                  127
@@ -341,23 +361,29 @@ void ERR_load_CMS_strings(void);
 #define CMS_R_CTRL_FAILURE                              108
 #define CMS_R_ERROR_GETTING_PUBLIC_KEY                  109
 #define CMS_R_ERROR_READING_MESSAGEDIGEST_ATTRIBUTE     110
+#define CMS_R_ERROR_SETTING_KEY                                 155
+#define CMS_R_ERROR_SETTING_RECIPIENTINFO               150
+#define CMS_R_INVALID_ENCRYPTED_KEY_LENGTH              156
 #define CMS_R_INVALID_KEY_LENGTH                        140
 #define CMS_R_MD_BIO_INIT_ERROR                                 111
 #define CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH      112
 #define CMS_R_MESSAGEDIGEST_WRONG_LENGTH                113
 #define CMS_R_NOT_ENCRYPTED_DATA                        143
+#define CMS_R_NOT_KEK                                   152
 #define CMS_R_NOT_KEY_TRANSPORT                                 114
 #define CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE           115
 #define CMS_R_NO_CIPHER                                         144
 #define CMS_R_NO_CONTENT                                116
 #define CMS_R_NO_DEFAULT_DIGEST                                 117
 #define CMS_R_NO_DIGEST_SET                             118
+#define CMS_R_NO_KEY                                    148
 #define CMS_R_NO_MATCHING_DIGEST                        119
 #define CMS_R_NO_MATCHING_RECIPIENT                     147
 #define CMS_R_NO_PRIVATE_KEY                            120
 #define CMS_R_NO_PUBLIC_KEY                             121
 #define CMS_R_NO_SIGNERS                                122
 #define CMS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE    123
+#define CMS_R_RECIPIENT_ERROR                           149
 #define CMS_R_SIGNER_CERTIFICATE_NOT_FOUND              124
 #define CMS_R_SIGNFINAL_ERROR                           125
 #define CMS_R_SMIME_TEXT_ERROR                          126
@@ -373,8 +399,13 @@ void ERR_load_CMS_strings(void);
 #define CMS_R_UNKNOWN_ID                                133
 #define CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM                 134
 #define CMS_R_UNSUPPORTED_CONTENT_TYPE                  135
+#define CMS_R_UNSUPPORTED_KEK_ALGORITHM                         153
+#define CMS_R_UNSUPPORTED_RECIPIENT_TYPE                151
+#define CMS_R_UNSUPPORTED_RECPIENTINFO_TYPE             154
 #define CMS_R_UNSUPPORTED_TYPE                          136
+#define CMS_R_UNWRAP_ERROR                              157
 #define CMS_R_VERIFICATION_FAILURE                      137
+#define CMS_R_WRAP_ERROR                                158
 
 #ifdef  __cplusplus
 }