xref: /netbsd-src/crypto/external/bsd/openssl.old/dist/include/openssl/cms.h (revision 4724848cf0da353df257f730694b7882798e5daf)
1*4724848cSchristos /*
2*4724848cSchristos  * Copyright 2008-2019 The OpenSSL Project Authors. All Rights Reserved.
3*4724848cSchristos  *
4*4724848cSchristos  * Licensed under the OpenSSL license (the "License").  You may not use
5*4724848cSchristos  * this file except in compliance with the License.  You can obtain a copy
6*4724848cSchristos  * in the file LICENSE in the source distribution or at
7*4724848cSchristos  * https://www.openssl.org/source/license.html
8*4724848cSchristos  */
9*4724848cSchristos 
10*4724848cSchristos #ifndef HEADER_CMS_H
11*4724848cSchristos # define HEADER_CMS_H
12*4724848cSchristos 
13*4724848cSchristos # include <openssl/opensslconf.h>
14*4724848cSchristos 
15*4724848cSchristos # ifndef OPENSSL_NO_CMS
16*4724848cSchristos # include <openssl/x509.h>
17*4724848cSchristos # include <openssl/x509v3.h>
18*4724848cSchristos # include <openssl/cmserr.h>
19*4724848cSchristos # ifdef __cplusplus
20*4724848cSchristos extern "C" {
21*4724848cSchristos # endif
22*4724848cSchristos 
23*4724848cSchristos typedef struct CMS_ContentInfo_st CMS_ContentInfo;
24*4724848cSchristos typedef struct CMS_SignerInfo_st CMS_SignerInfo;
25*4724848cSchristos typedef struct CMS_CertificateChoices CMS_CertificateChoices;
26*4724848cSchristos typedef struct CMS_RevocationInfoChoice_st CMS_RevocationInfoChoice;
27*4724848cSchristos typedef struct CMS_RecipientInfo_st CMS_RecipientInfo;
28*4724848cSchristos typedef struct CMS_ReceiptRequest_st CMS_ReceiptRequest;
29*4724848cSchristos typedef struct CMS_Receipt_st CMS_Receipt;
30*4724848cSchristos typedef struct CMS_RecipientEncryptedKey_st CMS_RecipientEncryptedKey;
31*4724848cSchristos typedef struct CMS_OtherKeyAttribute_st CMS_OtherKeyAttribute;
32*4724848cSchristos 
33*4724848cSchristos DEFINE_STACK_OF(CMS_SignerInfo)
34*4724848cSchristos DEFINE_STACK_OF(CMS_RecipientEncryptedKey)
35*4724848cSchristos DEFINE_STACK_OF(CMS_RecipientInfo)
36*4724848cSchristos DEFINE_STACK_OF(CMS_RevocationInfoChoice)
37*4724848cSchristos DECLARE_ASN1_FUNCTIONS(CMS_ContentInfo)
38*4724848cSchristos DECLARE_ASN1_FUNCTIONS(CMS_ReceiptRequest)
39*4724848cSchristos DECLARE_ASN1_PRINT_FUNCTION(CMS_ContentInfo)
40*4724848cSchristos 
41*4724848cSchristos # define CMS_SIGNERINFO_ISSUER_SERIAL    0
42*4724848cSchristos # define CMS_SIGNERINFO_KEYIDENTIFIER    1
43*4724848cSchristos 
44*4724848cSchristos # define CMS_RECIPINFO_NONE              -1
45*4724848cSchristos # define CMS_RECIPINFO_TRANS             0
46*4724848cSchristos # define CMS_RECIPINFO_AGREE             1
47*4724848cSchristos # define CMS_RECIPINFO_KEK               2
48*4724848cSchristos # define CMS_RECIPINFO_PASS              3
49*4724848cSchristos # define CMS_RECIPINFO_OTHER             4
50*4724848cSchristos 
51*4724848cSchristos /* S/MIME related flags */
52*4724848cSchristos 
53*4724848cSchristos # define CMS_TEXT                        0x1
54*4724848cSchristos # define CMS_NOCERTS                     0x2
55*4724848cSchristos # define CMS_NO_CONTENT_VERIFY           0x4
56*4724848cSchristos # define CMS_NO_ATTR_VERIFY              0x8
57*4724848cSchristos # define CMS_NOSIGS                      \
58*4724848cSchristos                         (CMS_NO_CONTENT_VERIFY|CMS_NO_ATTR_VERIFY)
59*4724848cSchristos # define CMS_NOINTERN                    0x10
60*4724848cSchristos # define CMS_NO_SIGNER_CERT_VERIFY       0x20
61*4724848cSchristos # define CMS_NOVERIFY                    0x20
62*4724848cSchristos # define CMS_DETACHED                    0x40
63*4724848cSchristos # define CMS_BINARY                      0x80
64*4724848cSchristos # define CMS_NOATTR                      0x100
65*4724848cSchristos # define CMS_NOSMIMECAP                  0x200
66*4724848cSchristos # define CMS_NOOLDMIMETYPE               0x400
67*4724848cSchristos # define CMS_CRLFEOL                     0x800
68*4724848cSchristos # define CMS_STREAM                      0x1000
69*4724848cSchristos # define CMS_NOCRL                       0x2000
70*4724848cSchristos # define CMS_PARTIAL                     0x4000
71*4724848cSchristos # define CMS_REUSE_DIGEST                0x8000
72*4724848cSchristos # define CMS_USE_KEYID                   0x10000
73*4724848cSchristos # define CMS_DEBUG_DECRYPT               0x20000
74*4724848cSchristos # define CMS_KEY_PARAM                   0x40000
75*4724848cSchristos # define CMS_ASCIICRLF                   0x80000
76*4724848cSchristos 
77*4724848cSchristos const ASN1_OBJECT *CMS_get0_type(const CMS_ContentInfo *cms);
78*4724848cSchristos 
79*4724848cSchristos BIO *CMS_dataInit(CMS_ContentInfo *cms, BIO *icont);
80*4724848cSchristos int CMS_dataFinal(CMS_ContentInfo *cms, BIO *bio);
81*4724848cSchristos 
82*4724848cSchristos ASN1_OCTET_STRING **CMS_get0_content(CMS_ContentInfo *cms);
83*4724848cSchristos int CMS_is_detached(CMS_ContentInfo *cms);
84*4724848cSchristos int CMS_set_detached(CMS_ContentInfo *cms, int detached);
85*4724848cSchristos 
86*4724848cSchristos # ifdef HEADER_PEM_H
87*4724848cSchristos DECLARE_PEM_rw_const(CMS, CMS_ContentInfo)
88*4724848cSchristos # endif
89*4724848cSchristos int CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms);
90*4724848cSchristos CMS_ContentInfo *d2i_CMS_bio(BIO *bp, CMS_ContentInfo **cms);
91*4724848cSchristos int i2d_CMS_bio(BIO *bp, CMS_ContentInfo *cms);
92*4724848cSchristos 
93*4724848cSchristos BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms);
94*4724848cSchristos int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags);
95*4724848cSchristos int PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *in,
96*4724848cSchristos                              int flags);
97*4724848cSchristos CMS_ContentInfo *SMIME_read_CMS(BIO *bio, BIO **bcont);
98*4724848cSchristos int SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags);
99*4724848cSchristos 
100*4724848cSchristos int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont,
101*4724848cSchristos               unsigned int flags);
102*4724848cSchristos 
103*4724848cSchristos CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey,
104*4724848cSchristos                           STACK_OF(X509) *certs, BIO *data,
105*4724848cSchristos                           unsigned int flags);
106*4724848cSchristos 
107*4724848cSchristos CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si,
108*4724848cSchristos                                   X509 *signcert, EVP_PKEY *pkey,
109*4724848cSchristos                                   STACK_OF(X509) *certs, unsigned int flags);
110*4724848cSchristos 
111*4724848cSchristos int CMS_data(CMS_ContentInfo *cms, BIO *out, unsigned int flags);
112*4724848cSchristos CMS_ContentInfo *CMS_data_create(BIO *in, unsigned int flags);
113*4724848cSchristos 
114*4724848cSchristos int CMS_digest_verify(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
115*4724848cSchristos                       unsigned int flags);
116*4724848cSchristos CMS_ContentInfo *CMS_digest_create(BIO *in, const EVP_MD *md,
117*4724848cSchristos                                    unsigned int flags);
118*4724848cSchristos 
119*4724848cSchristos int CMS_EncryptedData_decrypt(CMS_ContentInfo *cms,
120*4724848cSchristos                               const unsigned char *key, size_t keylen,
121*4724848cSchristos                               BIO *dcont, BIO *out, unsigned int flags);
122*4724848cSchristos 
123*4724848cSchristos CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher,
124*4724848cSchristos                                            const unsigned char *key,
125*4724848cSchristos                                            size_t keylen, unsigned int flags);
126*4724848cSchristos 
127*4724848cSchristos int CMS_EncryptedData_set1_key(CMS_ContentInfo *cms, const EVP_CIPHER *ciph,
128*4724848cSchristos                                const unsigned char *key, size_t keylen);
129*4724848cSchristos 
130*4724848cSchristos int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs,
131*4724848cSchristos                X509_STORE *store, BIO *dcont, BIO *out, unsigned int flags);
132*4724848cSchristos 
133*4724848cSchristos int CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms,
134*4724848cSchristos                        STACK_OF(X509) *certs,
135*4724848cSchristos                        X509_STORE *store, unsigned int flags);
136*4724848cSchristos 
137*4724848cSchristos STACK_OF(X509) *CMS_get0_signers(CMS_ContentInfo *cms);
138*4724848cSchristos 
139*4724848cSchristos CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *in,
140*4724848cSchristos                              const EVP_CIPHER *cipher, unsigned int flags);
141*4724848cSchristos 
142*4724848cSchristos int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pkey, X509 *cert,
143*4724848cSchristos                 BIO *dcont, BIO *out, unsigned int flags);
144*4724848cSchristos 
145*4724848cSchristos int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert);
146*4724848cSchristos int CMS_decrypt_set1_key(CMS_ContentInfo *cms,
147*4724848cSchristos                          unsigned char *key, size_t keylen,
148*4724848cSchristos                          const unsigned char *id, size_t idlen);
149*4724848cSchristos int CMS_decrypt_set1_password(CMS_ContentInfo *cms,
150*4724848cSchristos                               unsigned char *pass, ossl_ssize_t passlen);
151*4724848cSchristos 
152*4724848cSchristos STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms);
153*4724848cSchristos int CMS_RecipientInfo_type(CMS_RecipientInfo *ri);
154*4724848cSchristos EVP_PKEY_CTX *CMS_RecipientInfo_get0_pkey_ctx(CMS_RecipientInfo *ri);
155*4724848cSchristos CMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher);
156*4724848cSchristos CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms,
157*4724848cSchristos                                            X509 *recip, unsigned int flags);
158*4724848cSchristos int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey);
159*4724848cSchristos int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert);
160*4724848cSchristos int CMS_RecipientInfo_ktri_get0_algs(CMS_RecipientInfo *ri,
161*4724848cSchristos                                      EVP_PKEY **pk, X509 **recip,
162*4724848cSchristos                                      X509_ALGOR **palg);
163*4724848cSchristos int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri,
164*4724848cSchristos                                           ASN1_OCTET_STRING **keyid,
165*4724848cSchristos                                           X509_NAME **issuer,
166*4724848cSchristos                                           ASN1_INTEGER **sno);
167*4724848cSchristos 
168*4724848cSchristos CMS_RecipientInfo *CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid,
169*4724848cSchristos                                           unsigned char *key, size_t keylen,
170*4724848cSchristos                                           unsigned char *id, size_t idlen,
171*4724848cSchristos                                           ASN1_GENERALIZEDTIME *date,
172*4724848cSchristos                                           ASN1_OBJECT *otherTypeId,
173*4724848cSchristos                                           ASN1_TYPE *otherType);
174*4724848cSchristos 
175*4724848cSchristos int CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri,
176*4724848cSchristos                                     X509_ALGOR **palg,
177*4724848cSchristos                                     ASN1_OCTET_STRING **pid,
178*4724848cSchristos                                     ASN1_GENERALIZEDTIME **pdate,
179*4724848cSchristos                                     ASN1_OBJECT **potherid,
180*4724848cSchristos                                     ASN1_TYPE **pothertype);
181*4724848cSchristos 
182*4724848cSchristos int CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri,
183*4724848cSchristos                                unsigned char *key, size_t keylen);
184*4724848cSchristos 
185*4724848cSchristos int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri,
186*4724848cSchristos                                    const unsigned char *id, size_t idlen);
187*4724848cSchristos 
188*4724848cSchristos int CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri,
189*4724848cSchristos                                     unsigned char *pass,
190*4724848cSchristos                                     ossl_ssize_t passlen);
191*4724848cSchristos 
192*4724848cSchristos CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms,
193*4724848cSchristos                                                int iter, int wrap_nid,
194*4724848cSchristos                                                int pbe_nid,
195*4724848cSchristos                                                unsigned char *pass,
196*4724848cSchristos                                                ossl_ssize_t passlen,
197*4724848cSchristos                                                const EVP_CIPHER *kekciph);
198*4724848cSchristos 
199*4724848cSchristos int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);
200*4724848cSchristos int CMS_RecipientInfo_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);
201*4724848cSchristos 
202*4724848cSchristos int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
203*4724848cSchristos                    unsigned int flags);
204*4724848cSchristos CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags);
205*4724848cSchristos 
206*4724848cSchristos int CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid);
207*4724848cSchristos const ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms);
208*4724848cSchristos 
209*4724848cSchristos CMS_CertificateChoices *CMS_add0_CertificateChoices(CMS_ContentInfo *cms);
210*4724848cSchristos int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert);
211*4724848cSchristos int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert);
212*4724848cSchristos STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms);
213*4724848cSchristos 
214*4724848cSchristos CMS_RevocationInfoChoice *CMS_add0_RevocationInfoChoice(CMS_ContentInfo *cms);
215*4724848cSchristos int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl);
216*4724848cSchristos int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl);
217*4724848cSchristos STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms);
218*4724848cSchristos 
219*4724848cSchristos int CMS_SignedData_init(CMS_ContentInfo *cms);
220*4724848cSchristos CMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms,
221*4724848cSchristos                                 X509 *signer, EVP_PKEY *pk, const EVP_MD *md,
222*4724848cSchristos                                 unsigned int flags);
223*4724848cSchristos EVP_PKEY_CTX *CMS_SignerInfo_get0_pkey_ctx(CMS_SignerInfo *si);
224*4724848cSchristos EVP_MD_CTX *CMS_SignerInfo_get0_md_ctx(CMS_SignerInfo *si);
225*4724848cSchristos STACK_OF(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo *cms);
226*4724848cSchristos 
227*4724848cSchristos void CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer);
228*4724848cSchristos int CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si,
229*4724848cSchristos                                   ASN1_OCTET_STRING **keyid,
230*4724848cSchristos                                   X509_NAME **issuer, ASN1_INTEGER **sno);
231*4724848cSchristos int CMS_SignerInfo_cert_cmp(CMS_SignerInfo *si, X509 *cert);
232*4724848cSchristos int CMS_set1_signers_certs(CMS_ContentInfo *cms, STACK_OF(X509) *certs,
233*4724848cSchristos                            unsigned int flags);
234*4724848cSchristos void CMS_SignerInfo_get0_algs(CMS_SignerInfo *si, EVP_PKEY **pk,
235*4724848cSchristos                               X509 **signer, X509_ALGOR **pdig,
236*4724848cSchristos                               X509_ALGOR **psig);
237*4724848cSchristos ASN1_OCTET_STRING *CMS_SignerInfo_get0_signature(CMS_SignerInfo *si);
238*4724848cSchristos int CMS_SignerInfo_sign(CMS_SignerInfo *si);
239*4724848cSchristos int CMS_SignerInfo_verify(CMS_SignerInfo *si);
240*4724848cSchristos int CMS_SignerInfo_verify_content(CMS_SignerInfo *si, BIO *chain);
241*4724848cSchristos 
242*4724848cSchristos int CMS_add_smimecap(CMS_SignerInfo *si, STACK_OF(X509_ALGOR) *algs);
243*4724848cSchristos int CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **algs,
244*4724848cSchristos                             int algnid, int keysize);
245*4724848cSchristos int CMS_add_standard_smimecap(STACK_OF(X509_ALGOR) **smcap);
246*4724848cSchristos 
247*4724848cSchristos int CMS_signed_get_attr_count(const CMS_SignerInfo *si);
248*4724848cSchristos int CMS_signed_get_attr_by_NID(const CMS_SignerInfo *si, int nid,
249*4724848cSchristos                                int lastpos);
250*4724848cSchristos int CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, const ASN1_OBJECT *obj,
251*4724848cSchristos                                int lastpos);
252*4724848cSchristos X509_ATTRIBUTE *CMS_signed_get_attr(const CMS_SignerInfo *si, int loc);
253*4724848cSchristos X509_ATTRIBUTE *CMS_signed_delete_attr(CMS_SignerInfo *si, int loc);
254*4724848cSchristos int CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr);
255*4724848cSchristos int CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si,
256*4724848cSchristos                                 const ASN1_OBJECT *obj, int type,
257*4724848cSchristos                                 const void *bytes, int len);
258*4724848cSchristos int CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si,
259*4724848cSchristos                                 int nid, int type,
260*4724848cSchristos                                 const void *bytes, int len);
261*4724848cSchristos int CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si,
262*4724848cSchristos                                 const char *attrname, int type,
263*4724848cSchristos                                 const void *bytes, int len);
264*4724848cSchristos void *CMS_signed_get0_data_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *oid,
265*4724848cSchristos                                   int lastpos, int type);
266*4724848cSchristos 
267*4724848cSchristos int CMS_unsigned_get_attr_count(const CMS_SignerInfo *si);
268*4724848cSchristos int CMS_unsigned_get_attr_by_NID(const CMS_SignerInfo *si, int nid,
269*4724848cSchristos                                  int lastpos);
270*4724848cSchristos int CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si,
271*4724848cSchristos                                  const ASN1_OBJECT *obj, int lastpos);
272*4724848cSchristos X509_ATTRIBUTE *CMS_unsigned_get_attr(const CMS_SignerInfo *si, int loc);
273*4724848cSchristos X509_ATTRIBUTE *CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc);
274*4724848cSchristos int CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr);
275*4724848cSchristos int CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si,
276*4724848cSchristos                                   const ASN1_OBJECT *obj, int type,
277*4724848cSchristos                                   const void *bytes, int len);
278*4724848cSchristos int CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si,
279*4724848cSchristos                                   int nid, int type,
280*4724848cSchristos                                   const void *bytes, int len);
281*4724848cSchristos int CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si,
282*4724848cSchristos                                   const char *attrname, int type,
283*4724848cSchristos                                   const void *bytes, int len);
284*4724848cSchristos void *CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid,
285*4724848cSchristos                                     int lastpos, int type);
286*4724848cSchristos 
287*4724848cSchristos int CMS_get1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest **prr);
288*4724848cSchristos CMS_ReceiptRequest *CMS_ReceiptRequest_create0(unsigned char *id, int idlen,
289*4724848cSchristos                                                int allorfirst,
290*4724848cSchristos                                                STACK_OF(GENERAL_NAMES)
291*4724848cSchristos                                                *receiptList, STACK_OF(GENERAL_NAMES)
292*4724848cSchristos                                                *receiptsTo);
293*4724848cSchristos int CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr);
294*4724848cSchristos void CMS_ReceiptRequest_get0_values(CMS_ReceiptRequest *rr,
295*4724848cSchristos                                     ASN1_STRING **pcid,
296*4724848cSchristos                                     int *pallorfirst,
297*4724848cSchristos                                     STACK_OF(GENERAL_NAMES) **plist,
298*4724848cSchristos                                     STACK_OF(GENERAL_NAMES) **prto);
299*4724848cSchristos int CMS_RecipientInfo_kari_get0_alg(CMS_RecipientInfo *ri,
300*4724848cSchristos                                     X509_ALGOR **palg,
301*4724848cSchristos                                     ASN1_OCTET_STRING **pukm);
302*4724848cSchristos STACK_OF(CMS_RecipientEncryptedKey)
303*4724848cSchristos *CMS_RecipientInfo_kari_get0_reks(CMS_RecipientInfo *ri);
304*4724848cSchristos 
305*4724848cSchristos int CMS_RecipientInfo_kari_get0_orig_id(CMS_RecipientInfo *ri,
306*4724848cSchristos                                         X509_ALGOR **pubalg,
307*4724848cSchristos                                         ASN1_BIT_STRING **pubkey,
308*4724848cSchristos                                         ASN1_OCTET_STRING **keyid,
309*4724848cSchristos                                         X509_NAME **issuer,
310*4724848cSchristos                                         ASN1_INTEGER **sno);
311*4724848cSchristos 
312*4724848cSchristos int CMS_RecipientInfo_kari_orig_id_cmp(CMS_RecipientInfo *ri, X509 *cert);
313*4724848cSchristos 
314*4724848cSchristos int CMS_RecipientEncryptedKey_get0_id(CMS_RecipientEncryptedKey *rek,
315*4724848cSchristos                                       ASN1_OCTET_STRING **keyid,
316*4724848cSchristos                                       ASN1_GENERALIZEDTIME **tm,
317*4724848cSchristos                                       CMS_OtherKeyAttribute **other,
318*4724848cSchristos                                       X509_NAME **issuer, ASN1_INTEGER **sno);
319*4724848cSchristos int CMS_RecipientEncryptedKey_cert_cmp(CMS_RecipientEncryptedKey *rek,
320*4724848cSchristos                                        X509 *cert);
321*4724848cSchristos int CMS_RecipientInfo_kari_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pk);
322*4724848cSchristos EVP_CIPHER_CTX *CMS_RecipientInfo_kari_get0_ctx(CMS_RecipientInfo *ri);
323*4724848cSchristos int CMS_RecipientInfo_kari_decrypt(CMS_ContentInfo *cms,
324*4724848cSchristos                                    CMS_RecipientInfo *ri,
325*4724848cSchristos                                    CMS_RecipientEncryptedKey *rek);
326*4724848cSchristos 
327*4724848cSchristos int CMS_SharedInfo_encode(unsigned char **pder, X509_ALGOR *kekalg,
328*4724848cSchristos                           ASN1_OCTET_STRING *ukm, int keylen);
329*4724848cSchristos 
330*4724848cSchristos /* Backward compatibility for spelling errors. */
331*4724848cSchristos # define CMS_R_UNKNOWN_DIGEST_ALGORITM CMS_R_UNKNOWN_DIGEST_ALGORITHM
332*4724848cSchristos # define CMS_R_UNSUPPORTED_RECPIENTINFO_TYPE \
333*4724848cSchristos     CMS_R_UNSUPPORTED_RECIPIENTINFO_TYPE
334*4724848cSchristos 
335*4724848cSchristos #  ifdef  __cplusplus
336*4724848cSchristos }
337*4724848cSchristos #  endif
338*4724848cSchristos # endif
339*4724848cSchristos #endif
340