cms_lcl.h revision 296341
1145522Sdarrenr/* crypto/cms/cms_lcl.h */
2145522Sdarrenr/*
353642Sguido * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
4255332Scy * project.
553642Sguido */
680482Sdarrenr/* ====================================================================
753642Sguido * Copyright (c) 2008 The OpenSSL Project.  All rights reserved.
8145522Sdarrenr *
9145522Sdarrenr * Redistribution and use in source and binary forms, with or without
10145522Sdarrenr * modification, are permitted provided that the following conditions
11145522Sdarrenr * are met:
12145522Sdarrenr *
1353642Sguido * 1. Redistributions of source code must retain the above copyright
1453642Sguido *    notice, this list of conditions and the following disclaimer.
1553642Sguido *
1653642Sguido * 2. Redistributions in binary form must reproduce the above copyright
1753642Sguido *    notice, this list of conditions and the following disclaimer in
1853642Sguido *    the documentation and/or other materials provided with the
19255332Scy *    distribution.
20255332Scy *
21170268Sdarrenr * 3. All advertising materials mentioning features or use of this
22170268Sdarrenr *    software must display the following acknowledgment:
23145522Sdarrenr *    "This product includes software developed by the OpenSSL Project
2453642Sguido *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
2553642Sguido *
2653642Sguido * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
27255332Scy *    endorse or promote products derived from this software without
28255332Scy *    prior written permission. For written permission, please contact
29145522Sdarrenr *    licensing@OpenSSL.org.
30145522Sdarrenr *
31145522Sdarrenr * 5. Products derived from this software may not be called "OpenSSL"
32255332Scy *    nor may "OpenSSL" appear in their names without prior written
3353642Sguido *    permission of the OpenSSL Project.
34369277Scy *
3553642Sguido * 6. Redistributions of any form whatsoever must retain the following
3653642Sguido *    acknowledgment:
3753642Sguido *    "This product includes software developed by the OpenSSL Project
3853642Sguido *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
3953642Sguido *
40153876Sguido * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
4153642Sguido * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
4253642Sguido * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43145522Sdarrenr * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
4453642Sguido * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45344833Scy * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
4653642Sguido * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
4753642Sguido * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48145522Sdarrenr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
49344833Scy * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
5053642Sguido * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
5153642Sguido * OF THE POSSIBILITY OF SUCH DAMAGE.
52255332Scy * ====================================================================
5353642Sguido */
5453642Sguido
5553642Sguido#ifndef HEADER_CMS_LCL_H
5653642Sguido# define HEADER_CMS_LCL_H
5753642Sguido
58369277Scy#ifdef __cplusplus
5953642Sguidoextern "C" {
6053642Sguido#endif
6153642Sguido
62369277Scy# include <openssl/x509.h>
6353642Sguido
6453642Sguido/*
6553642Sguido * Cryptographic message syntax (CMS) structures: taken from RFC3852
6653642Sguido */
6753642Sguido
6853642Sguido/* Forward references */
6953642Sguido
7053642Sguidotypedef struct CMS_IssuerAndSerialNumber_st CMS_IssuerAndSerialNumber;
7153642Sguidotypedef struct CMS_EncapsulatedContentInfo_st CMS_EncapsulatedContentInfo;
7253642Sguidotypedef struct CMS_SignerIdentifier_st CMS_SignerIdentifier;
7353642Sguidotypedef struct CMS_SignedData_st CMS_SignedData;
7453642Sguidotypedef struct CMS_OtherRevocationInfoFormat_st CMS_OtherRevocationInfoFormat;
7553642Sguidotypedef struct CMS_OriginatorInfo_st CMS_OriginatorInfo;
7653642Sguidotypedef struct CMS_EncryptedContentInfo_st CMS_EncryptedContentInfo;
7753642Sguidotypedef struct CMS_EnvelopedData_st CMS_EnvelopedData;
7853642Sguidotypedef struct CMS_DigestedData_st CMS_DigestedData;
7953642Sguidotypedef struct CMS_EncryptedData_st CMS_EncryptedData;
8053642Sguidotypedef struct CMS_AuthenticatedData_st CMS_AuthenticatedData;
8153642Sguidotypedef struct CMS_CompressedData_st CMS_CompressedData;
8253642Sguidotypedef struct CMS_OtherCertificateFormat_st CMS_OtherCertificateFormat;
8353642Sguidotypedef struct CMS_KeyTransRecipientInfo_st CMS_KeyTransRecipientInfo;
84255332Scytypedef struct CMS_OriginatorPublicKey_st CMS_OriginatorPublicKey;
8553642Sguidotypedef struct CMS_OriginatorIdentifierOrKey_st CMS_OriginatorIdentifierOrKey;
8653642Sguidotypedef struct CMS_KeyAgreeRecipientInfo_st CMS_KeyAgreeRecipientInfo;
8753642Sguidotypedef struct CMS_OtherKeyAttribute_st CMS_OtherKeyAttribute;
8853642Sguidotypedef struct CMS_RecipientKeyIdentifier_st CMS_RecipientKeyIdentifier;
8992685Sdarrenrtypedef struct CMS_KeyAgreeRecipientIdentifier_st
90255332Scy    CMS_KeyAgreeRecipientIdentifier;
91255332Scytypedef struct CMS_RecipientEncryptedKey_st CMS_RecipientEncryptedKey;
92145522Sdarrenrtypedef struct CMS_KEKIdentifier_st CMS_KEKIdentifier;
93369277Scytypedef struct CMS_KEKRecipientInfo_st CMS_KEKRecipientInfo;
9453642Sguidotypedef struct CMS_PasswordRecipientInfo_st CMS_PasswordRecipientInfo;
9553642Sguidotypedef struct CMS_OtherRecipientInfo_st CMS_OtherRecipientInfo;
96255332Scytypedef struct CMS_ReceiptsFrom_st CMS_ReceiptsFrom;
97255332Scy
98255332Scystruct CMS_ContentInfo_st {
99255332Scy    ASN1_OBJECT *contentType;
100255332Scy    union {
101145522Sdarrenr        ASN1_OCTET_STRING *data;
102145522Sdarrenr        CMS_SignedData *signedData;
10353642Sguido        CMS_EnvelopedData *envelopedData;
10453642Sguido        CMS_DigestedData *digestedData;
10553642Sguido        CMS_EncryptedData *encryptedData;
10680482Sdarrenr        CMS_AuthenticatedData *authenticatedData;
10780482Sdarrenr        CMS_CompressedData *compressedData;
10880482Sdarrenr        ASN1_TYPE *other;
109172776Sdarrenr        /* Other types ... */
11080482Sdarrenr        void *otherData;
11180482Sdarrenr    } d;
112145522Sdarrenr};
113255332Scy
114255332Scystruct CMS_SignedData_st {
115255332Scy    long version;
116255332Scy    STACK_OF(X509_ALGOR) *digestAlgorithms;
117255332Scy    CMS_EncapsulatedContentInfo *encapContentInfo;
118255332Scy    STACK_OF(CMS_CertificateChoices) *certificates;
119255332Scy    STACK_OF(CMS_RevocationInfoChoice) *crls;
120255332Scy    STACK_OF(CMS_SignerInfo) *signerInfos;
121255332Scy};
122255332Scy
123255332Scystruct CMS_EncapsulatedContentInfo_st {
124255332Scy    ASN1_OBJECT *eContentType;
125255332Scy    ASN1_OCTET_STRING *eContent;
126255332Scy    /* Set to 1 if incomplete structure only part set up */
127255332Scy    int partial;
128255332Scy};
129255332Scy
130255332Scystruct CMS_SignerInfo_st {
131255332Scy    long version;
132255332Scy    CMS_SignerIdentifier *sid;
133255332Scy    X509_ALGOR *digestAlgorithm;
134255332Scy    STACK_OF(X509_ATTRIBUTE) *signedAttrs;
135255332Scy    X509_ALGOR *signatureAlgorithm;
136255332Scy    ASN1_OCTET_STRING *signature;
137255332Scy    STACK_OF(X509_ATTRIBUTE) *unsignedAttrs;
138255332Scy    /* Signing certificate and key */
139255332Scy    X509 *signer;
140255332Scy    EVP_PKEY *pkey;
141255332Scy};
142255332Scy
143255332Scystruct CMS_SignerIdentifier_st {
144255332Scy    int type;
145255332Scy    union {
146255332Scy        CMS_IssuerAndSerialNumber *issuerAndSerialNumber;
147255332Scy        ASN1_OCTET_STRING *subjectKeyIdentifier;
148255332Scy    } d;
149255332Scy};
150255332Scy
151255332Scystruct CMS_EnvelopedData_st {
152255332Scy    long version;
153255332Scy    CMS_OriginatorInfo *originatorInfo;
154255332Scy    STACK_OF(CMS_RecipientInfo) *recipientInfos;
155255332Scy    CMS_EncryptedContentInfo *encryptedContentInfo;
156255332Scy    STACK_OF(X509_ATTRIBUTE) *unprotectedAttrs;
157255332Scy};
158255332Scy
159255332Scystruct CMS_OriginatorInfo_st {
160255332Scy    STACK_OF(CMS_CertificateChoices) *certificates;
161255332Scy    STACK_OF(CMS_RevocationInfoChoice) *crls;
162255332Scy};
163255332Scy
164255332Scystruct CMS_EncryptedContentInfo_st {
165255332Scy    ASN1_OBJECT *contentType;
166255332Scy    X509_ALGOR *contentEncryptionAlgorithm;
167255332Scy    ASN1_OCTET_STRING *encryptedContent;
168255332Scy    /* Content encryption algorithm and key */
169255332Scy    const EVP_CIPHER *cipher;
170255332Scy    unsigned char *key;
171255332Scy    size_t keylen;
172255332Scy    /* Set to 1 if we are debugging decrypt and don't fake keys for MMA */
173255332Scy    int debug;
174255332Scy};
175255332Scy
176255332Scystruct CMS_RecipientInfo_st {
177255332Scy    int type;
178255332Scy    union {
179255332Scy        CMS_KeyTransRecipientInfo *ktri;
180255332Scy        CMS_KeyAgreeRecipientInfo *kari;
181145522Sdarrenr        CMS_KEKRecipientInfo *kekri;
182145522Sdarrenr        CMS_PasswordRecipientInfo *pwri;
183145522Sdarrenr        CMS_OtherRecipientInfo *ori;
184145522Sdarrenr    } d;
185145522Sdarrenr};
186255332Scy
187145522Sdarrenrtypedef CMS_SignerIdentifier CMS_RecipientIdentifier;
188145522Sdarrenr
189145522Sdarrenrstruct CMS_KeyTransRecipientInfo_st {
190255332Scy    long version;
191145522Sdarrenr    CMS_RecipientIdentifier *rid;
192145522Sdarrenr    X509_ALGOR *keyEncryptionAlgorithm;
193145522Sdarrenr    ASN1_OCTET_STRING *encryptedKey;
194255332Scy    /* Recipient Key and cert */
195145522Sdarrenr    X509 *recip;
196255332Scy    EVP_PKEY *pkey;
197145522Sdarrenr};
198145522Sdarrenr
199145522Sdarrenrstruct CMS_KeyAgreeRecipientInfo_st {
200145522Sdarrenr    long version;
201145522Sdarrenr    CMS_OriginatorIdentifierOrKey *originator;
202145522Sdarrenr    ASN1_OCTET_STRING *ukm;
203255332Scy    X509_ALGOR *keyEncryptionAlgorithm;
204255332Scy    STACK_OF(CMS_RecipientEncryptedKey) *recipientEncryptedKeys;
205255332Scy};
206255332Scy
207369245Sgit2svnstruct CMS_OriginatorIdentifierOrKey_st {
208369245Sgit2svn    int type;
209369245Sgit2svn    union {
210369245Sgit2svn        CMS_IssuerAndSerialNumber *issuerAndSerialNumber;
211369245Sgit2svn        ASN1_OCTET_STRING *subjectKeyIdentifier;
212369245Sgit2svn        CMS_OriginatorPublicKey *originatorKey;
213369245Sgit2svn    } d;
214369245Sgit2svn};
215369245Sgit2svn
216369245Sgit2svnstruct CMS_OriginatorPublicKey_st {
217369245Sgit2svn    X509_ALGOR *algorithm;
218369245Sgit2svn    ASN1_BIT_STRING *publicKey;
219369245Sgit2svn};
220369245Sgit2svn
221369245Sgit2svnstruct CMS_RecipientEncryptedKey_st {
222369245Sgit2svn    CMS_KeyAgreeRecipientIdentifier *rid;
223369245Sgit2svn    ASN1_OCTET_STRING *encryptedKey;
224369245Sgit2svn};
225369245Sgit2svn
226369245Sgit2svnstruct CMS_KeyAgreeRecipientIdentifier_st {
227255332Scy    int type;
228369245Sgit2svn    union {
229369245Sgit2svn        CMS_IssuerAndSerialNumber *issuerAndSerialNumber;
230369245Sgit2svn        CMS_RecipientKeyIdentifier *rKeyId;
231369245Sgit2svn    } d;
232369245Sgit2svn};
233369245Sgit2svn
234369245Sgit2svnstruct CMS_RecipientKeyIdentifier_st {
235369245Sgit2svn    ASN1_OCTET_STRING *subjectKeyIdentifier;
236369245Sgit2svn    ASN1_GENERALIZEDTIME *date;
237369245Sgit2svn    CMS_OtherKeyAttribute *other;
238369245Sgit2svn};
239369245Sgit2svn
240369245Sgit2svnstruct CMS_KEKRecipientInfo_st {
241369245Sgit2svn    long version;
242369245Sgit2svn    CMS_KEKIdentifier *kekid;
243369245Sgit2svn    X509_ALGOR *keyEncryptionAlgorithm;
244369245Sgit2svn    ASN1_OCTET_STRING *encryptedKey;
245369245Sgit2svn    /* Extra info: symmetric key to use */
246369245Sgit2svn    unsigned char *key;
247369245Sgit2svn    size_t keylen;
248369245Sgit2svn};
249369245Sgit2svn
250369245Sgit2svnstruct CMS_KEKIdentifier_st {
251369245Sgit2svn    ASN1_OCTET_STRING *keyIdentifier;
252369245Sgit2svn    ASN1_GENERALIZEDTIME *date;
253369245Sgit2svn    CMS_OtherKeyAttribute *other;
254369245Sgit2svn};
255369245Sgit2svn
256369245Sgit2svnstruct CMS_PasswordRecipientInfo_st {
257255332Scy    long version;
258255332Scy    X509_ALGOR *keyDerivationAlgorithm;
259255332Scy    X509_ALGOR *keyEncryptionAlgorithm;
260255332Scy    ASN1_OCTET_STRING *encryptedKey;
261255332Scy    /* Extra info: password to use */
262255332Scy    unsigned char *pass;
263255332Scy    size_t passlen;
264255332Scy};
265255332Scy
266255332Scystruct CMS_OtherRecipientInfo_st {
267255332Scy    ASN1_OBJECT *oriType;
268255332Scy    ASN1_TYPE *oriValue;
269255332Scy};
270255332Scy
271255332Scystruct CMS_DigestedData_st {
272255332Scy    long version;
273255332Scy    X509_ALGOR *digestAlgorithm;
274255332Scy    CMS_EncapsulatedContentInfo *encapContentInfo;
275255332Scy    ASN1_OCTET_STRING *digest;
276255332Scy};
277255332Scy
278255332Scystruct CMS_EncryptedData_st {
279255332Scy    long version;
280255332Scy    CMS_EncryptedContentInfo *encryptedContentInfo;
281255332Scy    STACK_OF(X509_ATTRIBUTE) *unprotectedAttrs;
282255332Scy};
283255332Scy
284255332Scystruct CMS_AuthenticatedData_st {
285255332Scy    long version;
286255332Scy    CMS_OriginatorInfo *originatorInfo;
287255332Scy    STACK_OF(CMS_RecipientInfo) *recipientInfos;
288255332Scy    X509_ALGOR *macAlgorithm;
289255332Scy    X509_ALGOR *digestAlgorithm;
290255332Scy    CMS_EncapsulatedContentInfo *encapContentInfo;
291255332Scy    STACK_OF(X509_ATTRIBUTE) *authAttrs;
292255332Scy    ASN1_OCTET_STRING *mac;
293255332Scy    STACK_OF(X509_ATTRIBUTE) *unauthAttrs;
294255332Scy};
295255332Scy
296255332Scystruct CMS_CompressedData_st {
297255332Scy    long version;
298255332Scy    X509_ALGOR *compressionAlgorithm;
299255332Scy    STACK_OF(CMS_RecipientInfo) *recipientInfos;
300255332Scy    CMS_EncapsulatedContentInfo *encapContentInfo;
301255332Scy};
302255332Scy
303255332Scystruct CMS_RevocationInfoChoice_st {
304255332Scy    int type;
305255332Scy    union {
306255332Scy        X509_CRL *crl;
307255332Scy        CMS_OtherRevocationInfoFormat *other;
308255332Scy    } d;
309255332Scy};
310255332Scy
311255332Scy# define CMS_REVCHOICE_CRL               0
312255332Scy# define CMS_REVCHOICE_OTHER             1
313255332Scy
314255332Scystruct CMS_OtherRevocationInfoFormat_st {
315255332Scy    ASN1_OBJECT *otherRevInfoFormat;
316255332Scy    ASN1_TYPE *otherRevInfo;
317255332Scy};
318255332Scy
319255332Scystruct CMS_CertificateChoices {
320255332Scy    int type;
321255332Scy    union {
322255332Scy        X509 *certificate;
323255332Scy        ASN1_STRING *extendedCertificate; /* Obsolete */
324255332Scy        ASN1_STRING *v1AttrCert; /* Left encoded for now */
325255332Scy        ASN1_STRING *v2AttrCert; /* Left encoded for now */
326255332Scy        CMS_OtherCertificateFormat *other;
327255332Scy    } d;
328255332Scy};
329255332Scy
330145522Sdarrenr# define CMS_CERTCHOICE_CERT             0
331255332Scy# define CMS_CERTCHOICE_EXCERT           1
332145522Sdarrenr# define CMS_CERTCHOICE_V1ACERT          2
333255332Scy# define CMS_CERTCHOICE_V2ACERT          3
334145522Sdarrenr# define CMS_CERTCHOICE_OTHER            4
33553642Sguido
336255332Scystruct CMS_OtherCertificateFormat_st {
337255332Scy    ASN1_OBJECT *otherCertFormat;
338255332Scy    ASN1_TYPE *otherCert;
339255332Scy};
340255332Scy
34153642Sguido/*
342255332Scy * This is also defined in pkcs7.h but we duplicate it to allow the CMS code
343255332Scy * to be independent of PKCS#7
34453642Sguido */
345255332Scy
346255332Scystruct CMS_IssuerAndSerialNumber_st {
347255332Scy    X509_NAME *issuer;
348255332Scy    ASN1_INTEGER *serialNumber;
349255332Scy};
350255332Scy
351255332Scystruct CMS_OtherKeyAttribute_st {
352255332Scy    ASN1_OBJECT *keyAttrId;
353255332Scy    ASN1_TYPE *keyAttr;
354255332Scy};
355255332Scy
356255332Scy/* ESS structures */
35753642Sguido
358255332Scy# ifdef HEADER_X509V3_H
359255332Scy
360255332Scystruct CMS_ReceiptRequest_st {
361255332Scy    ASN1_OCTET_STRING *signedContentIdentifier;
362255332Scy    CMS_ReceiptsFrom *receiptsFrom;
363255332Scy    STACK_OF(GENERAL_NAMES) *receiptsTo;
364255332Scy};
365255332Scy
366255332Scystruct CMS_ReceiptsFrom_st {
367255332Scy    int type;
368145522Sdarrenr    union {
369255332Scy        long allOrFirstTier;
370145522Sdarrenr        STACK_OF(GENERAL_NAMES) *receiptList;
371255332Scy    } d;
372145522Sdarrenr};
373145522Sdarrenr# endif
374145522Sdarrenr
375255332Scystruct CMS_Receipt_st {
376255332Scy    long version;
377255332Scy    ASN1_OBJECT *contentType;
378255332Scy    ASN1_OCTET_STRING *signedContentIdentifier;
37953642Sguido    ASN1_OCTET_STRING *originatorSignatureValue;
380255332Scy};
381255332Scy
382145522SdarrenrDECLARE_ASN1_FUNCTIONS(CMS_ContentInfo)
383145522SdarrenrDECLARE_ASN1_ITEM(CMS_SignerInfo)
384255332ScyDECLARE_ASN1_ITEM(CMS_IssuerAndSerialNumber)
385255332ScyDECLARE_ASN1_ITEM(CMS_Attributes_Sign)
386255332ScyDECLARE_ASN1_ITEM(CMS_Attributes_Verify)
387255332ScyDECLARE_ASN1_ITEM(CMS_RecipientInfo)
388255332ScyDECLARE_ASN1_ITEM(CMS_PasswordRecipientInfo)
389255332ScyDECLARE_ASN1_ALLOC_FUNCTIONS(CMS_IssuerAndSerialNumber)
390255332Scy
39153642Sguido# define CMS_SIGNERINFO_ISSUER_SERIAL    0
392255332Scy# define CMS_SIGNERINFO_KEYIDENTIFIER    1
39353642Sguido
394255332Scy# define CMS_RECIPINFO_ISSUER_SERIAL     0
395255332Scy# define CMS_RECIPINFO_KEYIDENTIFIER     1
396255332Scy
397255332ScyBIO *cms_content_bio(CMS_ContentInfo *cms);
398255332Scy
399255332ScyCMS_ContentInfo *cms_Data_create(void);
400255332Scy
401145522SdarrenrCMS_ContentInfo *cms_DigestedData_create(const EVP_MD *md);
402255332ScyBIO *cms_DigestedData_init_bio(CMS_ContentInfo *cms);
40353642Sguidoint cms_DigestedData_do_final(CMS_ContentInfo *cms, BIO *chain, int verify);
404255332Scy
405255332ScyBIO *cms_SignedData_init_bio(CMS_ContentInfo *cms);
406255332Scyint cms_SignedData_final(CMS_ContentInfo *cms, BIO *chain);
407255332Scyint cms_set1_SignerIdentifier(CMS_SignerIdentifier *sid, X509 *cert,
408255332Scy                              int type);
409255332Scyint cms_SignerIdentifier_get0_signer_id(CMS_SignerIdentifier *sid,
410255332Scy                                        ASN1_OCTET_STRING **keyid,
411145522Sdarrenr                                        X509_NAME **issuer,
412255332Scy                                        ASN1_INTEGER **sno);
41353642Sguidoint cms_SignerIdentifier_cert_cmp(CMS_SignerIdentifier *sid, X509 *cert);
414255332Scy
415255332ScyCMS_ContentInfo *cms_CompressedData_create(int comp_nid);
416255332ScyBIO *cms_CompressedData_init_bio(CMS_ContentInfo *cms);
417255332Scy
418255332Scyvoid cms_DigestAlgorithm_set(X509_ALGOR *alg, const EVP_MD *md);
419255332ScyBIO *cms_DigestAlgorithm_init_bio(X509_ALGOR *digestAlgorithm);
420255332Scyint cms_DigestAlgorithm_find_ctx(EVP_MD_CTX *mctx, BIO *chain,
421145522Sdarrenr                                 X509_ALGOR *mdalg);
422255332Scy
42360852SdarrenrBIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec);
424255332ScyBIO *cms_EncryptedData_init_bio(CMS_ContentInfo *cms);
425255332Scyint cms_EncryptedContent_init(CMS_EncryptedContentInfo *ec,
426255332Scy                              const EVP_CIPHER *cipher,
427255332Scy                              const unsigned char *key, size_t keylen);
428255332Scy
429255332Scyint cms_Receipt_verify(CMS_ContentInfo *cms, CMS_ContentInfo *req_cms);
430255332Scyint cms_msgSigDigest_add1(CMS_SignerInfo *dest, CMS_SignerInfo *src);
431145522SdarrenrASN1_OCTET_STRING *cms_encode_Receipt(CMS_SignerInfo *si);
432255332Scy
433255332ScyBIO *cms_EnvelopedData_init_bio(CMS_ContentInfo *cms);
434145522SdarrenrCMS_EnvelopedData *cms_get0_enveloped(CMS_ContentInfo *cms);
435255332Scy
436255332Scy/* PWRI routines */
437255332Scyint cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri,
438255332Scy                                 int en_de);
439145522Sdarrenr
440255332Scy#ifdef  __cplusplus
441255332Scy}
442255332Scy#endif
443145522Sdarrenr#endif
444255332Scy