]> git.saurik.com Git - apple/security.git/blame - libsecurity_smime/lib/SecCmsContentInfo.h
Security-58286.1.32.tar.gz
[apple/security.git] / libsecurity_smime / lib / SecCmsContentInfo.h
CommitLineData
b1ab9ed8 1/*
d8f41ccd 2 * Copyright (c) 2004,2008,2010 Apple Inc. All Rights Reserved.
b1ab9ed8
A
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24/*!
25 @header SecCmsContentInfo.h
d8f41ccd 26 @Copyright (c) 2004,2008,2010 Apple Inc. All Rights Reserved.
b1ab9ed8
A
27
28 @availability 10.4 and later
29 @abstract Interfaces of the CMS implementation.
30 @discussion The functions here implement functions for creating and
31 accessing ContentInfo objects that are part of Cryptographic
32 Message Syntax (CMS) objects as described in rfc3369.
33 */
34
35#ifndef _SECURITY_SECCMSCONTENTINFO_H_
36#define _SECURITY_SECCMSCONTENTINFO_H_ 1
37
38#include <Security/SecCmsBase.h>
d8f41ccd 39#include <CoreFoundation/CFData.h>
b1ab9ed8
A
40
41
42#if defined(__cplusplus)
43extern "C" {
44#endif
45
46
47/*! @functiongroup ContentInfo accessors */
48/*!
49 @function
50 @abstract Get content's contentInfo (if it exists).
51 @param cinfo A ContentInfo object of which we want to get the child contentInfo.
52 @result The child ContentInfo object, or NULL if there is none.
53 @discussion This function requires a ContentInfo object which is usually created by decoding and SecCmsMessage using a SecCmsDecoder.
54 @availability 10.4 and later
55 */
56extern SecCmsContentInfoRef
57SecCmsContentInfoGetChildContentInfo(SecCmsContentInfoRef cinfo);
58
59/*!
60 @function
61 @abstract Get pointer to inner content
62 @discussion needs to be casted...
63 */
64extern void *
65SecCmsContentInfoGetContent(SecCmsContentInfoRef cinfo);
66
67/*!
68 @function
69 @abstract Get pointer to innermost content
70 @discussion This is typically only called by SecCmsMessageGetContent().
71 */
d8f41ccd 72extern const SecAsn1Item *
b1ab9ed8
A
73SecCmsContentInfoGetInnerContent(SecCmsContentInfoRef cinfo);
74
75/*!
76 @function
77 @abstract Find out and return the inner content type.
78 */
79extern SECOidTag
80SecCmsContentInfoGetContentTypeTag(SecCmsContentInfoRef cinfo);
81
82/*!
83 @function
84 @abstract Find out and return the inner content type.
85 @discussion Caches pointer to lookup result for future reference.
86 */
d8f41ccd 87extern SecAsn1Oid *
b1ab9ed8
A
88SecCmsContentInfoGetContentTypeOID(SecCmsContentInfoRef cinfo);
89
90/*!
91 @function
92 @abstract Find out and return the content encryption algorithm tag.
93 */
94extern SECOidTag
95SecCmsContentInfoGetContentEncAlgTag(SecCmsContentInfoRef cinfo);
96
97/*!
98 @function
99 @abstract Find out and return the content encryption algorithm.
100 @discussion Caches pointer to lookup result for future reference.
101 */
102extern SECAlgorithmID *
103SecCmsContentInfoGetContentEncAlg(SecCmsContentInfoRef cinfo);
104
105
106/*! @functiongroup Message construction */
107/*!
108 @function
109 @abstract Set a ContentInfos content to a Data
b1ab9ed8 110 @param cinfo A ContentInfo object of which we want set the content.
d8f41ccd 111 @param data A CFDataRef or NULL if data will be provided during SecCmsEncoderUpdate calls.
b1ab9ed8
A
112 @param detached True if the content is to be deattched from the CMS message rather than included within it.
113 @result A result code. See "SecCmsBase.h" for possible results.
d8f41ccd 114 @discussion This function requires a ContentInfo object which can be made by creating a SecCmsMessage object.
b1ab9ed8
A
115 @availability 10.4 and later
116 */
117extern OSStatus
d8f41ccd 118SecCmsContentInfoSetContentData(SecCmsContentInfoRef cinfo, CFDataRef data, Boolean detached);
b1ab9ed8
A
119
120/*!
121 @function
122 @abstract Set a ContentInfos content to a SignedData.
b1ab9ed8
A
123 @param cinfo A ContentInfo object of which we want set the content.
124 @param sigd A SignedData object to set as the content of the cinfo object.
125 @result A result code. See "SecCmsBase.h" for possible results.
126 @discussion This function requires a ContentInfo object which can be made by creating a SecCmsMessage object and a SignedData which can be made by calling SecCmsSignedDataCreate(). If the call succeeds the passed in SignedData object will be owned by the reciever. The Message object of the SignedData object must be the same as cmsg.
127 @availability 10.4 and later
128 */
129extern OSStatus
d8f41ccd 130SecCmsContentInfoSetContentSignedData(SecCmsContentInfoRef cinfo, SecCmsSignedDataRef sigd);
b1ab9ed8
A
131
132/*!
133 @function
134 @abstract Set a ContentInfos content to a EnvelopedData.
b1ab9ed8
A
135 @param cinfo A ContentInfo object of which we want set the content.
136 @param envd A EnvelopedData object to set as the content of the cinfo object.
137 @result A result code. See "SecCmsBase.h" for possible results.
138 @discussion This function requires a ContentInfo object which can be made by creating a SecCmsMessage object and a EnvelopedData which can be made by calling SecCmsEnvelopedDataCreate(). If the call succeeds the passed in EnvelopedData object will be owned by the reciever. The Message object of the EnvelopedData object must be the same as cmsg.
139 @availability 10.4 and later
140 */
141extern OSStatus
d8f41ccd 142SecCmsContentInfoSetContentEnvelopedData(SecCmsContentInfoRef cinfo, SecCmsEnvelopedDataRef envd);
b1ab9ed8
A
143
144/*!
145 @function
146 @abstract Set a ContentInfos content to a DigestedData.
b1ab9ed8
A
147 @param cinfo A ContentInfo object of which we want set the content.
148 @param digd A DigestedData object to set as the content of the cinfo object.
149 @result A result code. See "SecCmsBase.h" for possible results.
150 @discussion This function requires a ContentInfo object which can be made by creating a SecCmsMessage object and a DigestedData which can be made by calling SecCmsDigestedDataCreate(). If the call succeeds the passed in DigestedData object will be owned by the reciever. The Message object of the DigestedData object must be the same as cmsg.
151 @availability 10.4 and later
152 */
153extern OSStatus
d8f41ccd 154SecCmsContentInfoSetContentDigestedData(SecCmsContentInfoRef cinfo, SecCmsDigestedDataRef digd);
b1ab9ed8
A
155
156/*!
157 @function
158 @abstract Set a ContentInfos content to a EncryptedData.
b1ab9ed8
A
159 @param cinfo A ContentInfo object of which we want set the content.
160 @param encd A EncryptedData object to set as the content of the cinfo object.
161 @result A result code. See "SecCmsBase.h" for possible results.
162 @discussion This function requires a ContentInfo object which can be made by creating a SecCmsMessage object and a EncryptedData which can be made by calling SecCmsEncryptedDataCreate(). If the call succeeds the passed in EncryptedData object will be owned by the reciever. The Message object of the EncryptedData object must be the same as cmsg.
163 @availability 10.4 and later
164 */
165extern OSStatus
d8f41ccd 166SecCmsContentInfoSetContentEncryptedData(SecCmsContentInfoRef cinfo, SecCmsEncryptedDataRef encd);
b1ab9ed8 167
866f8763
A
168OSStatus
169SecCmsContentInfoSetContentOther(SecCmsContentInfoRef cinfo, SecAsn1Item *data, Boolean detached, const SecAsn1Oid *eContentType);
170
b1ab9ed8
A
171/*!
172 @function
173 */
174extern OSStatus
d8f41ccd
A
175SecCmsContentInfoSetContentEncAlg(SecCmsContentInfoRef cinfo,
176 SECOidTag bulkalgtag, const SecAsn1Item *parameters, int keysize);
b1ab9ed8
A
177
178/*!
179 @function
180 */
181extern OSStatus
d8f41ccd 182SecCmsContentInfoSetContentEncAlgID(SecCmsContentInfoRef cinfo,
b1ab9ed8
A
183 SECAlgorithmID *algid, int keysize);
184
185/*!
186 @function
187 */
188extern void
189SecCmsContentInfoSetBulkKey(SecCmsContentInfoRef cinfo, SecSymmetricKeyRef bulkkey);
190
191/*!
192 @function
193 */
194extern SecSymmetricKeyRef
195SecCmsContentInfoGetBulkKey(SecCmsContentInfoRef cinfo);
196
197/*!
198 @function
199 */
200extern int
201SecCmsContentInfoGetBulkKeySize(SecCmsContentInfoRef cinfo);
202
203
204#if defined(__cplusplus)
205}
206#endif
207
208#endif /* _SECURITY_SECCMSCONTENTINFO_H_ */