2 * Copyright (c) 2000-2002 Apple Computer, Inc. All Rights Reserved.
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
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.
20 SecBase contains common declarations for the Security functions.
23 #ifndef _SECURITY_SECBASE_H_
24 #define _SECURITY_SECBASE_H_
26 #include <CoreFoundation/CFBase.h>
28 #if defined(__cplusplus)
36 @typedef SecKeychainRef
37 @abstract Contains information about a keychain.
39 typedef struct OpaqueSecKeychainRef
*SecKeychainRef
;
42 @typedef SecKeychainItemRef
43 @abstract Contains information about a keychain item.
45 typedef struct OpaqueSecKeychainItemRef
*SecKeychainItemRef
;
48 @typedef SecKeychainSearchRef
49 @abstract Contains information about a keychain search.
51 typedef struct OpaqueSecKeychainSearchRef
*SecKeychainSearchRef
;
54 @typedef SecKeychainAttrType
55 @abstract Represents a keychain attribute type.
57 typedef OSType SecKeychainAttrType
;
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.
66 struct SecKeychainAttribute
68 SecKeychainAttrType tag
;
72 typedef struct SecKeychainAttribute SecKeychainAttribute
;
75 @typedef SecKeychainAttributePtr
76 @abstract Represents a pointer to a keychain attribute structure.
78 typedef SecKeychainAttribute
*SecKeychainAttributePtr
;
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.
86 struct SecKeychainAttributeList
89 SecKeychainAttribute
*attr
;
91 typedef struct SecKeychainAttributeList SecKeychainAttributeList
;
94 @typedef SecKeychainStatus
95 @abstract Represents the status of a keychain.
97 typedef UInt32 SecKeychainStatus
;
101 @typedef SecTrustedApplicationRef
102 @abstract Contains information about a trusted application.
104 typedef struct OpaqueSecTrustedApplicationRef
*SecTrustedApplicationRef
;
107 @typedef SecPolicyRef
108 @abstract Contains information about a policy.
110 typedef struct OpaqueSecPolicyRef
*SecPolicyRef
;
113 @typedef SecCertificateRef
114 @abstract Contains information about a certificate.
116 typedef struct OpaqueSecCertificateRef
*SecCertificateRef
;
119 @typedef SecAccessRef
120 @abstract Contains information about an access.
122 typedef struct OpaqueSecAccessRef
*SecAccessRef
;
125 @typedef SecIdentityRef
126 @abstract Contains information about an identity.
128 typedef struct OpaqueSecIdentityRef
*SecIdentityRef
;
132 @abstract Contains information about a key.
134 typedef struct OpaqueSecKeyRef
*SecKeyRef
;
138 @abstract Contains information about an access control list (ACL) entry.
140 typedef struct OpaqueSecTrustRef
*SecACLRef
;
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.
150 struct SecKeychainAttributeInfo
156 typedef struct SecKeychainAttributeInfo SecKeychainAttributeInfo
;
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.
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,
226 errSecACLNotSimple
= -25240,
227 errSecPolicyNotFound
= -25241,
228 errSecInvalidTrustSetting
= -25242,
229 errSecNoAccessForItem
= -25243,
230 errSecInvalidOwnerEdit
= -25244
233 #if defined(__cplusplus)
237 #endif /* !_SECURITY_SECBASE_H_ */