]> git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_smime/lib/SecCmsContentInfo.h
Security-58286.270.3.0.1.tar.gz
[apple/security.git] / OSX / libsecurity_smime / lib / SecCmsContentInfo.h
1 /*
2 * Copyright (c) 2004,2011,2014 Apple Inc. All Rights Reserved.
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
26 @Copyright (c) 2004,2011,2014 Apple Inc. All Rights Reserved.
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>
39
40
41 #if defined(__cplusplus)
42 extern "C" {
43 #endif
44
45
46 /*! @functiongroup ContentInfo accessors */
47 /*!
48 @function
49 @abstract Get content's contentInfo (if it exists).
50 @param cinfo A ContentInfo object of which we want to get the child contentInfo.
51 @result The child ContentInfo object, or NULL if there is none.
52 @discussion This function requires a ContentInfo object which is usually created by decoding and SecCmsMessage using a SecCmsDecoder.
53 @availability 10.4 and later
54 */
55 extern SecCmsContentInfoRef
56 SecCmsContentInfoGetChildContentInfo(SecCmsContentInfoRef cinfo);
57
58 /*!
59 @function
60 @abstract Get pointer to inner content
61 @discussion needs to be casted...
62 */
63 extern void *
64 SecCmsContentInfoGetContent(SecCmsContentInfoRef cinfo);
65
66 /*!
67 @function
68 @abstract Get pointer to innermost content
69 @discussion This is typically only called by SecCmsMessageGetContent().
70 */
71 extern CSSM_DATA_PTR
72 SecCmsContentInfoGetInnerContent(SecCmsContentInfoRef cinfo) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
73
74 /*!
75 @function
76 @abstract Find out and return the inner content type.
77 */
78 extern SECOidTag
79 SecCmsContentInfoGetContentTypeTag(SecCmsContentInfoRef cinfo);
80
81 /*!
82 @function
83 @abstract Find out and return the inner content type.
84 @discussion Caches pointer to lookup result for future reference.
85 */
86 extern CSSM_OID *
87 SecCmsContentInfoGetContentTypeOID(SecCmsContentInfoRef cinfo) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
88
89 /*!
90 @function
91 @abstract Find out and return the content encryption algorithm tag.
92 */
93 extern SECOidTag
94 SecCmsContentInfoGetContentEncAlgTag(SecCmsContentInfoRef cinfo);
95
96 /*!
97 @function
98 @abstract Find out and return the content encryption algorithm.
99 @discussion Caches pointer to lookup result for future reference.
100 */
101 extern SECAlgorithmID *
102 SecCmsContentInfoGetContentEncAlg(SecCmsContentInfoRef cinfo) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
103
104
105 /*! @functiongroup Message construction */
106 /*!
107 @function
108 @abstract Set a ContentInfos content to a Data
109 @param cmsg A Message object to which the cinfo object belongs.
110 @param cinfo A ContentInfo object of which we want set the content.
111 @param data A pointer to a CSSM_DATA object or NULL if data will be provided during SecCmsEncoderUpdate calls.
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.
114 @discussion This function requires a ContentInfo object which can be made by creating a SecCmsMessage object. If the call succeeds the passed in data will be owned by the reciever. The data->Data must have been allocated using the cmsg's SecArenaPool if it is present.
115 @availability 10.4 and later
116 */
117 extern OSStatus
118 SecCmsContentInfoSetContentData(SecCmsMessageRef cmsg, SecCmsContentInfoRef cinfo, CSSM_DATA_PTR data, Boolean detached) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
119
120 /*!
121 @function
122 @abstract Set a ContentInfos content to a SignedData.
123 @param cmsg A Message object to which the cinfo object belongs.
124 @param cinfo A ContentInfo object of which we want set the content.
125 @param sigd A SignedData object to set as the content of the cinfo object.
126 @result A result code. See "SecCmsBase.h" for possible results.
127 @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.
128 @availability 10.4 and later
129 */
130 extern OSStatus
131 SecCmsContentInfoSetContentSignedData(SecCmsMessageRef cmsg, SecCmsContentInfoRef cinfo, SecCmsSignedDataRef sigd);
132
133 /*!
134 @function
135 @abstract Set a ContentInfos content to a EnvelopedData.
136 @param cmsg A Message object to which the cinfo object belongs.
137 @param cinfo A ContentInfo object of which we want set the content.
138 @param envd A EnvelopedData object to set as the content of the cinfo object.
139 @result A result code. See "SecCmsBase.h" for possible results.
140 @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.
141 @availability 10.4 and later
142 */
143 extern OSStatus
144 SecCmsContentInfoSetContentEnvelopedData(SecCmsMessageRef cmsg, SecCmsContentInfoRef cinfo, SecCmsEnvelopedDataRef envd);
145
146 /*!
147 @function
148 @abstract Set a ContentInfos content to a DigestedData.
149 @param cmsg A Message object to which the cinfo object belongs.
150 @param cinfo A ContentInfo object of which we want set the content.
151 @param digd A DigestedData object to set as the content of the cinfo object.
152 @result A result code. See "SecCmsBase.h" for possible results.
153 @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.
154 @availability 10.4 and later
155 */
156 extern OSStatus
157 SecCmsContentInfoSetContentDigestedData(SecCmsMessageRef cmsg, SecCmsContentInfoRef cinfo, SecCmsDigestedDataRef digd);
158
159 /*!
160 @function
161 @abstract Set a ContentInfos content to a EncryptedData.
162 @param cmsg A Message object to which the cinfo object belongs.
163 @param cinfo A ContentInfo object of which we want set the content.
164 @param encd A EncryptedData object to set as the content of the cinfo object.
165 @result A result code. See "SecCmsBase.h" for possible results.
166 @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.
167 @availability 10.4 and later
168 */
169 extern OSStatus
170 SecCmsContentInfoSetContentEncryptedData(SecCmsMessageRef cmsg, SecCmsContentInfoRef cinfo, SecCmsEncryptedDataRef encd);
171
172 OSStatus
173 SecCmsContentInfoSetContentOther(SecCmsMessageRef cmsg, SecCmsContentInfoRef cinfo, CSSM_DATA_PTR data, Boolean detached, const CSSM_OID *eContentType) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
174
175 /*!
176 @function
177 */
178 extern OSStatus
179 SecCmsContentInfoSetContentEncAlg(SecArenaPoolRef pool, SecCmsContentInfoRef cinfo,
180 SECOidTag bulkalgtag, CSSM_DATA_PTR parameters, int keysize) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
181
182 /*!
183 @function
184 */
185 extern OSStatus
186 SecCmsContentInfoSetContentEncAlgID(SecArenaPoolRef pool, SecCmsContentInfoRef cinfo,
187 SECAlgorithmID *algid, int keysize) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
188
189 /*!
190 @function
191 */
192 extern void
193 SecCmsContentInfoSetBulkKey(SecCmsContentInfoRef cinfo, SecSymmetricKeyRef bulkkey);
194
195 /*!
196 @function
197 */
198 extern SecSymmetricKeyRef
199 SecCmsContentInfoGetBulkKey(SecCmsContentInfoRef cinfo);
200
201 /*!
202 @function
203 */
204 extern int
205 SecCmsContentInfoGetBulkKeySize(SecCmsContentInfoRef cinfo);
206
207
208 #if defined(__cplusplus)
209 }
210 #endif
211
212 #endif /* _SECURITY_SECCMSCONTENTINFO_H_ */