cms_lcl.h revision 238405
1139749Simp/* crypto/cms/cms_lcl.h */
251694Sroger/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
351694Sroger * project.
448781Sroger */
548781Sroger/* ====================================================================
623599Smarkm * Copyright (c) 2008 The OpenSSL Project.  All rights reserved.
723599Smarkm *
823599Smarkm * Redistribution and use in source and binary forms, with or without
923599Smarkm * modification, are permitted provided that the following conditions
1023599Smarkm * are met:
1123599Smarkm *
1223599Smarkm * 1. Redistributions of source code must retain the above copyright
1323599Smarkm *    notice, this list of conditions and the following disclaimer.
1423599Smarkm *
1523599Smarkm * 2. Redistributions in binary form must reproduce the above copyright
1623599Smarkm *    notice, this list of conditions and the following disclaimer in
1723599Smarkm *    the documentation and/or other materials provided with the
1823599Smarkm *    distribution.
1923599Smarkm *
2023599Smarkm * 3. All advertising materials mentioning features or use of this
2123599Smarkm *    software must display the following acknowledgment:
2223599Smarkm *    "This product includes software developed by the OpenSSL Project
2323599Smarkm *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
2423599Smarkm *
2523599Smarkm * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
2623599Smarkm *    endorse or promote products derived from this software without
2723599Smarkm *    prior written permission. For written permission, please contact
2823599Smarkm *    licensing@OpenSSL.org.
2923599Smarkm *
3023599Smarkm * 5. Products derived from this software may not be called "OpenSSL"
3123599Smarkm *    nor may "OpenSSL" appear in their names without prior written
3223599Smarkm *    permission of the OpenSSL Project.
3323599Smarkm *
3439838Ssos * 6. Redistributions of any form whatsoever must retain the following
3523599Smarkm *    acknowledgment:
3651694Sroger *    "This product includes software developed by the OpenSSL Project
3759014Sroger *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
3859014Sroger *
3959014Sroger * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
4059014Sroger * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
4162112Sroger * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
4262112Sroger * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
4362112Sroger * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
4462112Sroger * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
4562112Sroger * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
4651694Sroger * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
4751694Sroger * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
4862112Sroger * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
4962112Sroger * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
5062112Sroger * OF THE POSSIBILITY OF SUCH DAMAGE.
5162112Sroger * ====================================================================
5262112Sroger */
5362112Sroger
5467306Sroger#ifndef HEADER_CMS_LCL_H
5567306Sroger#define HEADER_CMS_LCL_H
5667306Sroger
5767306Sroger#ifdef __cplusplus
5862112Srogerextern "C" {
5962112Sroger#endif
6062112Sroger
6162112Sroger#include <openssl/x509.h>
6262112Sroger
6362112Sroger/* Cryptographic message syntax (CMS) structures: taken
6462112Sroger * from RFC3852
6562112Sroger */
6662112Sroger
6762112Sroger/* Forward references */
6862112Sroger
6962112Srogertypedef struct CMS_IssuerAndSerialNumber_st CMS_IssuerAndSerialNumber;
7062112Srogertypedef struct CMS_EncapsulatedContentInfo_st CMS_EncapsulatedContentInfo;
7162112Srogertypedef struct CMS_SignerIdentifier_st CMS_SignerIdentifier;
7262112Srogertypedef struct CMS_SignedData_st CMS_SignedData;
7362112Srogertypedef struct CMS_OtherRevocationInfoFormat_st CMS_OtherRevocationInfoFormat;
7462112Srogertypedef struct CMS_OriginatorInfo_st CMS_OriginatorInfo;
7562112Srogertypedef struct CMS_EncryptedContentInfo_st CMS_EncryptedContentInfo;
7662112Srogertypedef struct CMS_EnvelopedData_st CMS_EnvelopedData;
7762112Srogertypedef struct CMS_DigestedData_st CMS_DigestedData;
7862112Srogertypedef struct CMS_EncryptedData_st CMS_EncryptedData;
7962112Srogertypedef struct CMS_AuthenticatedData_st CMS_AuthenticatedData;
8062112Srogertypedef struct CMS_CompressedData_st CMS_CompressedData;
8123599Smarkmtypedef struct CMS_OtherCertificateFormat_st CMS_OtherCertificateFormat;
8223599Smarkmtypedef struct CMS_KeyTransRecipientInfo_st CMS_KeyTransRecipientInfo;
8323599Smarkmtypedef struct CMS_OriginatorPublicKey_st CMS_OriginatorPublicKey;
8423599Smarkmtypedef struct CMS_OriginatorIdentifierOrKey_st CMS_OriginatorIdentifierOrKey;
8523599Smarkmtypedef struct CMS_KeyAgreeRecipientInfo_st CMS_KeyAgreeRecipientInfo;
8647884Srogertypedef struct CMS_OtherKeyAttribute_st CMS_OtherKeyAttribute;
8723599Smarkmtypedef struct CMS_RecipientKeyIdentifier_st CMS_RecipientKeyIdentifier;
8867306Srogertypedef struct CMS_KeyAgreeRecipientIdentifier_st CMS_KeyAgreeRecipientIdentifier;
8967306Srogertypedef struct CMS_RecipientEncryptedKey_st CMS_RecipientEncryptedKey;
9067306Srogertypedef struct CMS_KEKIdentifier_st CMS_KEKIdentifier;
9167306Srogertypedef struct CMS_KEKRecipientInfo_st CMS_KEKRecipientInfo;
9267306Srogertypedef struct CMS_PasswordRecipientInfo_st CMS_PasswordRecipientInfo;
9323599Smarkmtypedef struct CMS_OtherRecipientInfo_st CMS_OtherRecipientInfo;
9467306Srogertypedef struct CMS_ReceiptsFrom_st CMS_ReceiptsFrom;
9567306Sroger
9667306Srogerstruct CMS_ContentInfo_st
9767306Sroger	{
9867306Sroger	ASN1_OBJECT *contentType;
9967306Sroger	union	{
10067306Sroger		ASN1_OCTET_STRING *data;
10167306Sroger		CMS_SignedData *signedData;
10267306Sroger		CMS_EnvelopedData *envelopedData;
10367306Sroger		CMS_DigestedData *digestedData;
10467306Sroger		CMS_EncryptedData *encryptedData;
10567306Sroger		CMS_AuthenticatedData *authenticatedData;
10667306Sroger		CMS_CompressedData *compressedData;
10767306Sroger		ASN1_TYPE *other;
10843771Sroger		/* Other types ... */
10943771Sroger		void *otherData;
11047492Sroger		} d;
11143771Sroger	};
11243771Sroger
11343771Srogerstruct CMS_SignedData_st
11424246Sfsmp	{
11524246Sfsmp	long version;
11624246Sfsmp	STACK_OF(X509_ALGOR) *digestAlgorithms;
11724246Sfsmp	CMS_EncapsulatedContentInfo *encapContentInfo;
11824246Sfsmp	STACK_OF(CMS_CertificateChoices) *certificates;
11924246Sfsmp	STACK_OF(CMS_RevocationInfoChoice) *crls;
12024246Sfsmp	STACK_OF(CMS_SignerInfo) *signerInfos;
12124246Sfsmp	};
12224246Sfsmp
12323599Smarkmstruct CMS_EncapsulatedContentInfo_st
12424246Sfsmp	{
12524246Sfsmp	ASN1_OBJECT *eContentType;
12624528Sfsmp	ASN1_OCTET_STRING *eContent;
12724528Sfsmp	/* Set to 1 if incomplete structure only part set up */
12824528Sfsmp	int partial;
12924528Sfsmp	};
13024528Sfsmp
13138707Ssosstruct CMS_SignerInfo_st
13224528Sfsmp	{
13324528Sfsmp	long version;
13424246Sfsmp	CMS_SignerIdentifier *sid;
13524528Sfsmp	X509_ALGOR *digestAlgorithm;
13624528Sfsmp	STACK_OF(X509_ATTRIBUTE) *signedAttrs;
13724528Sfsmp	X509_ALGOR *signatureAlgorithm;
13824528Sfsmp	ASN1_OCTET_STRING *signature;
13937611Sahasty	STACK_OF(X509_ATTRIBUTE) *unsignedAttrs;
14024528Sfsmp	/* Signing certificate and key */
14124528Sfsmp	X509 *signer;
14224528Sfsmp	EVP_PKEY *pkey;
14324528Sfsmp	};
14424528Sfsmp
14524528Sfsmpstruct CMS_SignerIdentifier_st
14624246Sfsmp	{
14724246Sfsmp	int type;
14824246Sfsmp	union	{
14924246Sfsmp		CMS_IssuerAndSerialNumber *issuerAndSerialNumber;
15024246Sfsmp		ASN1_OCTET_STRING *subjectKeyIdentifier;
15124246Sfsmp		} d;
15224246Sfsmp	};
15324246Sfsmp
15424246Sfsmpstruct CMS_EnvelopedData_st
15524246Sfsmp	{
15624528Sfsmp	long version;
15724528Sfsmp	CMS_OriginatorInfo *originatorInfo;
15824528Sfsmp	STACK_OF(CMS_RecipientInfo) *recipientInfos;
15924528Sfsmp	CMS_EncryptedContentInfo *encryptedContentInfo;
16024528Sfsmp	STACK_OF(X509_ATTRIBUTE) *unprotectedAttrs;
16124528Sfsmp	};
16224528Sfsmp
16324528Sfsmpstruct CMS_OriginatorInfo_st
16424246Sfsmp	{
16524246Sfsmp	STACK_OF(CMS_CertificateChoices) *certificates;
16624246Sfsmp	STACK_OF(CMS_RevocationInfoChoice) *crls;
16724246Sfsmp	};
16824246Sfsmp
16924528Sfsmpstruct CMS_EncryptedContentInfo_st
17024528Sfsmp	{
17124528Sfsmp	ASN1_OBJECT *contentType;
17224528Sfsmp	X509_ALGOR *contentEncryptionAlgorithm;
17324528Sfsmp	ASN1_OCTET_STRING *encryptedContent;
17424528Sfsmp	/* Content encryption algorithm and key */
17524528Sfsmp	const EVP_CIPHER *cipher;
17624528Sfsmp	unsigned char *key;
17724528Sfsmp	size_t keylen;
17824246Sfsmp	/* Set to 1 if we are debugging decrypt and don't fake keys for MMA */
17924246Sfsmp	int debug;
18024246Sfsmp	};
18124246Sfsmp
18224246Sfsmpstruct CMS_RecipientInfo_st
18324246Sfsmp	{
18424246Sfsmp 	int type;
18524246Sfsmp 	union	{
18624246Sfsmp  	 	CMS_KeyTransRecipientInfo *ktri;
18724246Sfsmp   		CMS_KeyAgreeRecipientInfo *kari;
18824528Sfsmp   		CMS_KEKRecipientInfo *kekri;
18924528Sfsmp		CMS_PasswordRecipientInfo *pwri;
19024528Sfsmp		CMS_OtherRecipientInfo *ori;
19124528Sfsmp		} d;
19224528Sfsmp	};
19324528Sfsmp
19424528Sfsmptypedef CMS_SignerIdentifier CMS_RecipientIdentifier;
19524246Sfsmp
19624246Sfsmpstruct CMS_KeyTransRecipientInfo_st
19724246Sfsmp	{
19824246Sfsmp	long version;
19924246Sfsmp	CMS_RecipientIdentifier *rid;
20038707Ssos	X509_ALGOR *keyEncryptionAlgorithm;
20138707Ssos	ASN1_OCTET_STRING *encryptedKey;
20238707Ssos	/* Recipient Key and cert */
20338707Ssos	X509 *recip;
20438707Ssos	EVP_PKEY *pkey;
20538707Ssos	};
20638707Ssos
20738707Ssosstruct CMS_KeyAgreeRecipientInfo_st
20824246Sfsmp	{
20924246Sfsmp	long version;
21024246Sfsmp	CMS_OriginatorIdentifierOrKey *originator;
21124246Sfsmp	ASN1_OCTET_STRING *ukm;
21224246Sfsmp 	X509_ALGOR *keyEncryptionAlgorithm;
21324246Sfsmp	STACK_OF(CMS_RecipientEncryptedKey) *recipientEncryptedKeys;
21424246Sfsmp	};
21524246Sfsmp
21624246Sfsmpstruct CMS_OriginatorIdentifierOrKey_st
21724528Sfsmp	{
21824528Sfsmp	int type;
21924528Sfsmp	union	{
22024528Sfsmp		CMS_IssuerAndSerialNumber *issuerAndSerialNumber;
22124528Sfsmp		ASN1_OCTET_STRING *subjectKeyIdentifier;
22224528Sfsmp		CMS_OriginatorPublicKey *originatorKey;
22324528Sfsmp		} d;
22424528Sfsmp	};
22559014Sroger
22624246Sfsmpstruct CMS_OriginatorPublicKey_st
22724528Sfsmp	{
22824528Sfsmp	X509_ALGOR *algorithm;
22924528Sfsmp	ASN1_BIT_STRING *publicKey;
23024528Sfsmp	};
23138707Ssos
23238707Ssosstruct CMS_RecipientEncryptedKey_st
23338707Ssos	{
23438707Ssos 	CMS_KeyAgreeRecipientIdentifier *rid;
23524528Sfsmp 	ASN1_OCTET_STRING *encryptedKey;
23624246Sfsmp	};
23724246Sfsmp
23824246Sfsmpstruct CMS_KeyAgreeRecipientIdentifier_st
23924246Sfsmp	{
24024246Sfsmp	int type;
24125329Sfsmp	union	{
24224528Sfsmp		CMS_IssuerAndSerialNumber *issuerAndSerialNumber;
24324528Sfsmp		CMS_RecipientKeyIdentifier *rKeyId;
24424528Sfsmp		} d;
24524528Sfsmp	};
24625329Sfsmp
24725329Sfsmpstruct CMS_RecipientKeyIdentifier_st
24825329Sfsmp	{
24925329Sfsmp 	ASN1_OCTET_STRING *subjectKeyIdentifier;
25059014Sroger 	ASN1_GENERALIZEDTIME *date;
25159014Sroger 	CMS_OtherKeyAttribute *other;
25259014Sroger	};
25359014Sroger
25425329Sfsmpstruct CMS_KEKRecipientInfo_st
25524246Sfsmp	{
25624528Sfsmp 	long version;
25724528Sfsmp 	CMS_KEKIdentifier *kekid;
25824528Sfsmp 	X509_ALGOR *keyEncryptionAlgorithm;
25924528Sfsmp 	ASN1_OCTET_STRING *encryptedKey;
26024528Sfsmp	/* Extra info: symmetric key to use */
26124246Sfsmp	unsigned char *key;
26224246Sfsmp	size_t keylen;
26324246Sfsmp	};
26424246Sfsmp
26538707Ssosstruct CMS_KEKIdentifier_st
26638707Ssos	{
26738707Ssos 	ASN1_OCTET_STRING *keyIdentifier;
26838707Ssos 	ASN1_GENERALIZEDTIME *date;
26938707Ssos 	CMS_OtherKeyAttribute *other;
27038707Ssos	};
27124246Sfsmp
27224246Sfsmpstruct CMS_PasswordRecipientInfo_st
27324528Sfsmp	{
27424528Sfsmp 	long version;
27524528Sfsmp 	X509_ALGOR *keyDerivationAlgorithm;
27624528Sfsmp 	X509_ALGOR *keyEncryptionAlgorithm;
27724528Sfsmp 	ASN1_OCTET_STRING *encryptedKey;
27824528Sfsmp	/* Extra info: password to use */
27924528Sfsmp	unsigned char *pass;
28024528Sfsmp	size_t passlen;
28124528Sfsmp	};
28224528Sfsmp
28324528Sfsmpstruct CMS_OtherRecipientInfo_st
28424528Sfsmp	{
28524528Sfsmp 	ASN1_OBJECT *oriType;
28624528Sfsmp 	ASN1_TYPE *oriValue;
28724528Sfsmp	};
28824528Sfsmp
28924528Sfsmpstruct CMS_DigestedData_st
29024528Sfsmp	{
29124528Sfsmp	long version;
29224528Sfsmp	X509_ALGOR *digestAlgorithm;
29324528Sfsmp	CMS_EncapsulatedContentInfo *encapContentInfo;
29424528Sfsmp	ASN1_OCTET_STRING *digest;
29524528Sfsmp	};
29624528Sfsmp
29724246Sfsmpstruct CMS_EncryptedData_st
29824246Sfsmp	{
29929233Smarkm	long version;
30029233Smarkm	CMS_EncryptedContentInfo *encryptedContentInfo;
30129233Smarkm	STACK_OF(X509_ATTRIBUTE) *unprotectedAttrs;
30229233Smarkm	};
30329233Smarkm
30429233Smarkmstruct CMS_AuthenticatedData_st
30529233Smarkm	{
30629233Smarkm	long version;
30729233Smarkm	CMS_OriginatorInfo *originatorInfo;
30829233Smarkm	STACK_OF(CMS_RecipientInfo) *recipientInfos;
30929233Smarkm	X509_ALGOR *macAlgorithm;
31029233Smarkm	X509_ALGOR *digestAlgorithm;
31124528Sfsmp	CMS_EncapsulatedContentInfo *encapContentInfo;
31224528Sfsmp	STACK_OF(X509_ATTRIBUTE) *authAttrs;
31324246Sfsmp	ASN1_OCTET_STRING *mac;
31424528Sfsmp	STACK_OF(X509_ATTRIBUTE) *unauthAttrs;
31524528Sfsmp	};
31624528Sfsmp
31724528Sfsmpstruct CMS_CompressedData_st
31824528Sfsmp	{
31924246Sfsmp	long version;
32024246Sfsmp	X509_ALGOR *compressionAlgorithm;
32124246Sfsmp	STACK_OF(CMS_RecipientInfo) *recipientInfos;
32224246Sfsmp	CMS_EncapsulatedContentInfo *encapContentInfo;
32324246Sfsmp	};
32424246Sfsmp
32524246Sfsmpstruct CMS_RevocationInfoChoice_st
32623599Smarkm	{
32724246Sfsmp	int type;
32824087Sfsmp	union	{
32924087Sfsmp		X509_CRL *crl;
33024087Sfsmp		CMS_OtherRevocationInfoFormat *other;
33159014Sroger		} d;
33259014Sroger	};
33324087Sfsmp
33424087Sfsmp#define CMS_REVCHOICE_CRL		0
33524087Sfsmp#define CMS_REVCHOICE_OTHER		1
33624087Sfsmp
33724087Sfsmpstruct CMS_OtherRevocationInfoFormat_st
33824087Sfsmp	{
33924087Sfsmp	ASN1_OBJECT *otherRevInfoFormat;
34024087Sfsmp 	ASN1_TYPE *otherRevInfo;
34124087Sfsmp	};
34224087Sfsmp
34324087Sfsmpstruct CMS_CertificateChoices
34424087Sfsmp	{
34524087Sfsmp	int type;
34624087Sfsmp		union {
34724087Sfsmp		X509 *certificate;
34824087Sfsmp		ASN1_STRING *extendedCertificate;	/* Obsolete */
34924087Sfsmp		ASN1_STRING *v1AttrCert;	/* Left encoded for now */
35024087Sfsmp		ASN1_STRING *v2AttrCert;	/* Left encoded for now */
35124087Sfsmp		CMS_OtherCertificateFormat *other;
35224087Sfsmp		} d;
35324087Sfsmp	};
35424087Sfsmp
35524087Sfsmp#define CMS_CERTCHOICE_CERT		0
35624087Sfsmp#define CMS_CERTCHOICE_EXCERT		1
35724087Sfsmp#define CMS_CERTCHOICE_V1ACERT		2
35824087Sfsmp#define CMS_CERTCHOICE_V2ACERT		3
35924087Sfsmp#define CMS_CERTCHOICE_OTHER		4
36024087Sfsmp
36124087Sfsmpstruct CMS_OtherCertificateFormat_st
36224087Sfsmp	{
36324087Sfsmp	ASN1_OBJECT *otherCertFormat;
36424087Sfsmp 	ASN1_TYPE *otherCert;
36524087Sfsmp	};
36624087Sfsmp
36724087Sfsmp/* This is also defined in pkcs7.h but we duplicate it
36824087Sfsmp * to allow the CMS code to be independent of PKCS#7
36924087Sfsmp */
37024087Sfsmp
37124087Sfsmpstruct CMS_IssuerAndSerialNumber_st
37224087Sfsmp	{
37324087Sfsmp	X509_NAME *issuer;
37424087Sfsmp	ASN1_INTEGER *serialNumber;
37524087Sfsmp	};
37624087Sfsmp
37724087Sfsmpstruct CMS_OtherKeyAttribute_st
37824087Sfsmp	{
37959014Sroger	ASN1_OBJECT *keyAttrId;
38059014Sroger 	ASN1_TYPE *keyAttr;
38159014Sroger	};
38259014Sroger
38359014Sroger/* ESS structures */
38423599Smarkm
38523599Smarkm#ifdef HEADER_X509V3_H
38623599Smarkm
38723599Smarkmstruct CMS_ReceiptRequest_st
38824528Sfsmp	{
38924528Sfsmp	ASN1_OCTET_STRING *signedContentIdentifier;
39024246Sfsmp	CMS_ReceiptsFrom *receiptsFrom;
39124528Sfsmp	STACK_OF(GENERAL_NAMES) *receiptsTo;
39224528Sfsmp	};
39324528Sfsmp
39424528Sfsmp
39524528Sfsmpstruct CMS_ReceiptsFrom_st
39633850Sahasty	{
39723599Smarkm	int type;
39823599Smarkm	union
39924528Sfsmp		{
40024528Sfsmp		long allOrFirstTier;
40124528Sfsmp		STACK_OF(GENERAL_NAMES) *receiptList;
40224528Sfsmp		} d;
40333025Sahasty	};
40424528Sfsmp#endif
40533025Sahasty
40633025Sahastystruct CMS_Receipt_st
40733025Sahasty	{
40833025Sahasty	long version;
40933025Sahasty	ASN1_OBJECT *contentType;
41024528Sfsmp	ASN1_OCTET_STRING *signedContentIdentifier;
41124528Sfsmp	ASN1_OCTET_STRING *originatorSignatureValue;
41224528Sfsmp	};
41324246Sfsmp
41424246SfsmpDECLARE_ASN1_FUNCTIONS(CMS_ContentInfo)
41539041SsosDECLARE_ASN1_ITEM(CMS_SignerInfo)
41624528SfsmpDECLARE_ASN1_ITEM(CMS_IssuerAndSerialNumber)
41739838SsosDECLARE_ASN1_ITEM(CMS_Attributes_Sign)
41839838SsosDECLARE_ASN1_ITEM(CMS_Attributes_Verify)
41930856SeivindDECLARE_ASN1_ITEM(CMS_RecipientInfo)
42030856SeivindDECLARE_ASN1_ITEM(CMS_PasswordRecipientInfo)
42152593SrogerDECLARE_ASN1_ALLOC_FUNCTIONS(CMS_IssuerAndSerialNumber)
42224528Sfsmp
42324528Sfsmp#define CMS_SIGNERINFO_ISSUER_SERIAL	0
42446876Sroger#define CMS_SIGNERINFO_KEYIDENTIFIER	1
42546876Sroger
42646876Sroger#define CMS_RECIPINFO_ISSUER_SERIAL	0
42746876Sroger#define CMS_RECIPINFO_KEYIDENTIFIER	1
42824246Sfsmp
42923599SmarkmBIO *cms_content_bio(CMS_ContentInfo *cms);
43024528Sfsmp
43124528SfsmpCMS_ContentInfo *cms_Data_create(void);
43224528Sfsmp
43324528SfsmpCMS_ContentInfo *cms_DigestedData_create(const EVP_MD *md);
43424528SfsmpBIO *cms_DigestedData_init_bio(CMS_ContentInfo *cms);
43538706Ssosint cms_DigestedData_do_final(CMS_ContentInfo *cms, BIO *chain, int verify);
43638706Ssos
43738706SsosBIO *cms_SignedData_init_bio(CMS_ContentInfo *cms);
43829233Smarkmint cms_SignedData_final(CMS_ContentInfo *cms, BIO *chain);
43938706Ssosint cms_set1_SignerIdentifier(CMS_SignerIdentifier *sid, X509 *cert, int type);
44030856Seivindint cms_SignerIdentifier_get0_signer_id(CMS_SignerIdentifier *sid,
44138706Ssos					ASN1_OCTET_STRING **keyid,
44230856Seivind					X509_NAME **issuer, ASN1_INTEGER **sno);
44346175Srogerint cms_SignerIdentifier_cert_cmp(CMS_SignerIdentifier *sid, X509 *cert);
44446175Sroger
44524528SfsmpCMS_ContentInfo *cms_CompressedData_create(int comp_nid);
44624528SfsmpBIO *cms_CompressedData_init_bio(CMS_ContentInfo *cms);
44765692Sroger
44840781Snsouchvoid cms_DigestAlgorithm_set(X509_ALGOR *alg, const EVP_MD *md);
44993023SnsouchBIO *cms_DigestAlgorithm_init_bio(X509_ALGOR *digestAlgorithm);
45093023Snsouchint cms_DigestAlgorithm_find_ctx(EVP_MD_CTX *mctx, BIO *chain,
45193023Snsouch					X509_ALGOR *mdalg);
45240781Snsouch
45340781SnsouchBIO *cms_EncryptedContent_init_bio(CMS_EncryptedContentInfo *ec);
45440781SnsouchBIO *cms_EncryptedData_init_bio(CMS_ContentInfo *cms);
45525329Sfsmpint cms_EncryptedContent_init(CMS_EncryptedContentInfo *ec,
45659014Sroger				const EVP_CIPHER *cipher,
45759014Sroger				const unsigned char *key, size_t keylen);
45859014Sroger
45959014Srogerint cms_Receipt_verify(CMS_ContentInfo *cms, CMS_ContentInfo *req_cms);
46059014Srogerint cms_msgSigDigest_add1(CMS_SignerInfo *dest, CMS_SignerInfo *src);
46159014SrogerASN1_OCTET_STRING *cms_encode_Receipt(CMS_SignerInfo *si);
46259014Sroger
46359014SrogerBIO *cms_EnvelopedData_init_bio(CMS_ContentInfo *cms);
464139919SimpCMS_EnvelopedData *cms_get0_enveloped(CMS_ContentInfo *cms);
46559014Sroger
46659014Sroger/* PWRI routines */
46759014Srogerint cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri,
46859014Sroger							int en_de);
46959014Sroger
47059014Sroger#ifdef  __cplusplus
47159014Sroger}
47259014Sroger#endif
47359014Sroger#endif
47459014Sroger