]> git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_cms/lib/CMSPrivate.h
Security-57336.1.9.tar.gz
[apple/security.git] / OSX / libsecurity_cms / lib / CMSPrivate.h
1 /*
2 * Copyright (c) 2006,2011-2012,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 * CMSPrivate.h - access to low-level CMS objects used by CMSDecoder and CMSEncoder.
26 */
27 #ifndef _CMS_PRIVATE_H_
28 #define _CMS_PRIVATE_H_
29
30 #include <Security/CMSEncoder.h>
31 #include <Security/CMSDecoder.h>
32 #include <Security/SecCmsEncoder.h>
33 #include <Security/SecCmsDecoder.h>
34 #include <Security/SecCmsMessage.h>
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40 /***
41 *** Private CMSEncoder routines
42 ***/
43
44 /*
45 * Obtain the SecCmsMessageRef associated with a CMSEncoderRef. Intended
46 * to be called after (optionally) setting the encoder's various attributes
47 * via CMSEncoderAddSigners(), CMSEncoderAddRecipients(), etc. and before
48 * the first call to CMSEncoderUpdateContent(). The returned SecCmsMessageRef
49 * will be initialized per the previously specified attributes; the caller
50 * can manipulate the SecCmsMessageRef prior to proceeding with
51 * CMSEncoderUpdateContent() calls.
52 */
53 OSStatus CMSEncoderGetCmsMessage(
54 CMSEncoderRef cmsEncoder,
55 SecCmsMessageRef *cmsMessage); /* RETURNED */
56
57 /*
58 * Optionally specify a SecCmsEncoderRef to use with a CMSEncoderRef.
59 * If this is called, it must be called before the first call to
60 * CMSEncoderUpdateContent(). The CMSEncoderRef takes ownership of the
61 * incoming SecCmsEncoderRef.
62 */
63 OSStatus CMSEncoderSetEncoder(
64 CMSEncoderRef cmsEncoder,
65 SecCmsEncoderRef encoder);
66
67 /*
68 * Obtain the SecCmsEncoderRef associated with a CMSEncoderRef.
69 * Returns a NULL SecCmsEncoderRef if neither CMSEncoderSetEncoder nor
70 * CMSEncoderUpdateContent() has been called.
71 * The CMSEncoderRef retains ownership of the SecCmsEncoderRef.
72 */
73 OSStatus CMSEncoderGetEncoder(
74 CMSEncoderRef cmsEncoder,
75 SecCmsEncoderRef *encoder); /* RETURNED */
76
77 /*
78 * Set the signing time for a CMSEncoder.
79 * This is only used if the kCMSAttrSigningTime attribute is included.
80 */
81 OSStatus CMSEncoderSetSigningTime(
82 CMSEncoderRef cmsEncoder,
83 CFAbsoluteTime time);
84
85 void
86 CmsMessageSetTSAContext(CMSEncoderRef cmsEncoder, CFTypeRef tsaContext);
87
88 /***
89 *** Private CMSDecoder routines
90 ***/
91
92 /*
93 * Obtain the SecCmsMessageRef associated with a CMSDecoderRef. Intended
94 * to be called after decoding the message (i.e., after
95 * CMSDecoderFinalizeMessage() to gain finer access to the contents of the
96 * SecCmsMessageRef than is otherwise available via the CMSDecoder interface.
97 * Returns a NULL SecCmsMessageRef if CMSDecoderFinalizeMessage() has not been
98 * called.
99 *
100 * The CMSDecoder retains ownership of the returned SecCmsMessageRef.
101 */
102 OSStatus CMSDecoderGetCmsMessage(
103 CMSDecoderRef cmsDecoder,
104 SecCmsMessageRef *cmsMessage); /* RETURNED */
105
106
107 /*
108 * Optionally specify a SecCmsDecoderRef to use with a CMSDecoderRef.
109 * If this is called, it must be called before the first call to
110 * CMSDecoderUpdateMessage(). The CMSDecoderRef takes ownership of the
111 * incoming SecCmsDecoderRef.
112 */
113 OSStatus CMSDecoderSetDecoder(
114 CMSDecoderRef cmsDecoder,
115 SecCmsDecoderRef decoder);
116
117 /*
118 * Obtain the SecCmsDecoderRef associated with a CMSDecoderRef.
119 * Returns a NULL SecCmsDecoderRef if neither CMSDecoderSetDecoder() nor
120 * CMSDecoderUpdateMessage() has been called.
121 * The CMSDecoderRef retains ownership of the SecCmsDecoderRef.
122 */
123 OSStatus CMSDecoderGetDecoder(
124 CMSDecoderRef cmsDecoder,
125 SecCmsDecoderRef *decoder); /* RETURNED */
126
127 #ifdef __cplusplus
128 }
129 #endif
130
131 #endif /* _CMS_PRIVATE_H_ */
132