]> git.saurik.com Git - apple/security.git/blob - Keychain/SecBase.h
Security-54.1.tar.gz
[apple/security.git] / Keychain / SecBase.h
1 /*
2 * Copyright (c) 2000-2002 Apple Computer, Inc. All Rights Reserved.
3 *
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
8 * using this file.
9 *
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
16 */
17
18 /*!
19 @header SecBase
20 SecBase contains common declarations for the Security functions.
21 */
22
23 #ifndef _SECURITY_SECBASE_H_
24 #define _SECURITY_SECBASE_H_
25
26 #include <CoreFoundation/CFBase.h>
27
28 #if defined(__cplusplus)
29 extern "C" {
30 #endif
31
32 #ifndef __SEC_TYPES__
33 #define __SEC_TYPES__
34
35 /*!
36 @typedef SecKeychainRef
37 @abstract Contains information about a keychain.
38 */
39 typedef struct OpaqueSecKeychainRef *SecKeychainRef;
40
41 /*!
42 @typedef SecKeychainItemRef
43 @abstract Contains information about a keychain item.
44 */
45 typedef struct OpaqueSecKeychainItemRef *SecKeychainItemRef;
46
47 /*!
48 @typedef SecKeychainSearchRef
49 @abstract Contains information about a keychain search.
50 */
51 typedef struct OpaqueSecKeychainSearchRef *SecKeychainSearchRef;
52
53 /*!
54 @typedef SecKeychainAttrType
55 @abstract Represents a keychain attribute type.
56 */
57 typedef OSType SecKeychainAttrType;
58
59 /*!
60 @struct SecKeychainAttribute
61 @abstract Contains keychain attributes.
62 @field tag A 4-byte attribute tag.
63 @field length The length of the buffer pointed to by data.
64 @field data A pointer to the attribute data.
65 */
66 struct SecKeychainAttribute
67 {
68 SecKeychainAttrType tag;
69 UInt32 length;
70 void *data;
71 };
72 typedef struct SecKeychainAttribute SecKeychainAttribute;
73
74 /*!
75 @typedef SecKeychainAttributePtr
76 @abstract Represents a pointer to a keychain attribute structure.
77 */
78 typedef SecKeychainAttribute *SecKeychainAttributePtr;
79
80 /*!
81 @typedef SecKeychainAttributeList
82 @abstract Represents a list of keychain attributes.
83 @field count An unsigned 32-bit integer that represents the number of keychain attributes in the array.
84 @field attr A pointer to the first keychain attribute in the array.
85 */
86 struct SecKeychainAttributeList
87 {
88 UInt32 count;
89 SecKeychainAttribute *attr;
90 };
91 typedef struct SecKeychainAttributeList SecKeychainAttributeList;
92
93 /*!
94 @typedef SecKeychainStatus
95 @abstract Represents the status of a keychain.
96 */
97 typedef UInt32 SecKeychainStatus;
98 #endif
99
100 /*!
101 @typedef SecTrustedApplicationRef
102 @abstract Contains information about a trusted application.
103 */
104 typedef struct OpaqueSecTrustedApplicationRef *SecTrustedApplicationRef;
105
106 /*!
107 @typedef SecPolicyRef
108 @abstract Contains information about a policy.
109 */
110 typedef struct OpaqueSecPolicyRef *SecPolicyRef;
111
112 /*!
113 @typedef SecCertificateRef
114 @abstract Contains information about a certificate.
115 */
116 typedef struct OpaqueSecCertificateRef *SecCertificateRef;
117
118 /*!
119 @typedef SecAccessRef
120 @abstract Contains information about an access.
121 */
122 typedef struct OpaqueSecAccessRef *SecAccessRef;
123
124 /*!
125 @typedef SecIdentityRef
126 @abstract Contains information about an identity.
127 */
128 typedef struct OpaqueSecIdentityRef *SecIdentityRef;
129
130 /*!
131 @typedef SecKeyRef
132 @abstract Contains information about a key.
133 */
134 typedef struct OpaqueSecKeyRef *SecKeyRef;
135
136 /*!
137 @typedef SecACLRef
138 @abstract Contains information about an access control list (ACL) entry.
139 */
140 typedef struct OpaqueSecTrustRef *SecACLRef;
141
142 /*!
143 @typedef SecKeychainAttributeInfo
144 @abstract Represents an attribute.
145 @field count The number of tag-format pairs in the respective arrays.
146 @field tag A pointer to the first attribute tag in the array.
147 @field format A pointer to the first attribute format in the array.
148 @discussion Each tag and format item form a pair.
149 */
150 struct SecKeychainAttributeInfo
151 {
152 UInt32 count;
153 UInt32 *tag;
154 UInt32 *format;
155 };
156 typedef struct SecKeychainAttributeInfo SecKeychainAttributeInfo;
157
158 /*!
159 @enum Security Error Codes
160 @abstract Represents the result codes.
161 @constant errSecNotAvailable No trust results are available.
162 @constant errSecReadOnly Read only error.
163 @constant errSecAuthFailed Authorization/Authentication failed.
164 @constant errSecNoSuchKeychain The keychain does not exist.
165 @constant errSecInvalidKeychain The keychain is not valid.
166 @constant errSecDuplicateKeychain A keychain with the same name already exists.
167 @constant errSecDuplicateCallback More than one callback of the same name exists.
168 @constant errSecInvalidCallback The callback is not valid.
169 @constant errSecDuplicateItem The item already exists.
170 @constant errSecItemNotFound The item cannot be found.
171 @constant errSecBufferTooSmall The buffer is too small.
172 @constant errSecDataTooLarge The data is too large.
173 @constant errSecNoSuchAttr The attribute does not exist.
174 @constant errSecInvalidItemRef The item reference is invalid.
175 @constant errSecInvalidSearchRef The search reference is invalid.
176 @constant errSecNoSuchClass The keychain item class does not exist.
177 @constant errSecNoDefaultKeychain A default keychain does not exist.
178 @constant errSecInteractionNotAllowed Interaction is not allowed with the Security Server.
179 @constant errSecReadOnlyAttr The attribute is read only.
180 @constant errSecWrongSecVersion The version is incorrect.
181 @constant errSecKeySizeNotAllowed The key size is not allowed.
182 @constant errSecNoStorageModule There is no storage module available.
183 @constant errSecNoCertificateModule There is no certificate module available.
184 @constant errSecNoPolicyModule There is no policy module available.
185 @constant errSecInteractionRequired User interaction is required.
186 @constant errSecDataNotAvailable The data is not available.
187 @constant errSecDataNotModifiable The data is not modifiable.
188 @constant errSecCreateChainFailed The attempt to create a certificate chain failed.
189 @constant errSecACLNotSimple The access control list is not in standard simple form.
190 @constant errSecPolicyNotFound The policy specified cannot be found.
191 @constant errSecInvalidTrustSetting The trust setting is invalid.
192 @constant errSecNoAccessForItem The specified item has no access control.
193 @discussion The assigned error space is discontinuous: -25240..-25279, -25290..25329.
194 */
195 enum
196 {
197 errSecNotAvailable = -25291,
198 errSecReadOnly = -25292,
199 errSecAuthFailed = -25293,
200 errSecNoSuchKeychain = -25294,
201 errSecInvalidKeychain = -25295,
202 errSecDuplicateKeychain = -25296,
203 errSecDuplicateCallback = -25297,
204 errSecInvalidCallback = -25298,
205 errSecDuplicateItem = -25299,
206 errSecItemNotFound = -25300,
207 errSecBufferTooSmall = -25301,
208 errSecDataTooLarge = -25302,
209 errSecNoSuchAttr = -25303,
210 errSecInvalidItemRef = -25304,
211 errSecInvalidSearchRef = -25305,
212 errSecNoSuchClass = -25306,
213 errSecNoDefaultKeychain = -25307,
214 errSecInteractionNotAllowed = -25308,
215 errSecReadOnlyAttr = -25309,
216 errSecWrongSecVersion = -25310,
217 errSecKeySizeNotAllowed = -25311,
218 errSecNoStorageModule = -25312,
219 errSecNoCertificateModule = -25313,
220 errSecNoPolicyModule = -25314,
221 errSecInteractionRequired = -25315,
222 errSecDataNotAvailable = -25316,
223 errSecDataNotModifiable = -25317,
224 errSecCreateChainFailed = -25318,
225
226 errSecACLNotSimple = -25240,
227 errSecPolicyNotFound = -25241,
228 errSecInvalidTrustSetting = -25242,
229 errSecNoAccessForItem = -25243,
230 errSecInvalidOwnerEdit = -25244
231 };
232
233 #if defined(__cplusplus)
234 }
235 #endif
236
237 #endif /* !_SECURITY_SECBASE_H_ */