]> git.saurik.com Git - apple/security.git/blob - OSX/sec/Security/SecBase.h
Security-57337.20.44.tar.gz
[apple/security.git] / OSX / sec / Security / SecBase.h
1 /*
2 * Copyright (c) 2000-2009,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 SecBase
26 SecBase contains common declarations for the Security functions.
27 */
28
29 #ifndef _SECURITY_SECBASE_H_
30 #define _SECURITY_SECBASE_H_
31
32 #include <Availability.h>
33 #include <sys/cdefs.h>
34 #include <CoreFoundation/CFBase.h>
35
36 #if defined(__clang__)
37 #define SEC_DEPRECATED_ATTRIBUTE DEPRECATED_ATTRIBUTE
38 #else
39 #define SEC_DEPRECATED_ATTRIBUTE
40 #endif
41
42 __BEGIN_DECLS
43
44 CF_ASSUME_NONNULL_BEGIN
45 CF_IMPLICIT_BRIDGING_ENABLED
46
47 /*!
48 @typedef SecCertificateRef
49 @abstract CFType representing a X.509 certificate.
50 See SecCertificate.h for details.
51 */
52 typedef struct CF_BRIDGED_TYPE(id) __SecCertificate *SecCertificateRef;
53
54 /*!
55 @typedef SecIdentityRef
56 @abstract CFType representing an identity, which contains
57 a SecKeyRef and an associated SecCertificateRef. See
58 SecIdentity.h for details.
59 */
60 typedef struct CF_BRIDGED_TYPE(id) __SecIdentity *SecIdentityRef;
61
62 /*!
63 @typedef SecKeyRef
64 @abstract CFType representing a cryptographic key. See
65 SecKey.h for details.
66 */
67 typedef struct CF_BRIDGED_TYPE(id) __SecKey *SecKeyRef;
68
69 /*!
70 @typedef SecPolicyRef
71 @abstract CFType representing a X.509 certificate trust policy.
72 See SecPolicy.h for details.
73 */
74 typedef struct CF_BRIDGED_TYPE(id) __SecPolicy *SecPolicyRef;
75
76 /*!
77 @typedef SecAccessControl
78 @abstract CFType representing access control for an item.
79 SecAccessControl.h for details.
80 */
81 typedef struct CF_BRIDGED_TYPE(id) __SecAccessControl *SecAccessControlRef;
82
83 /***********************************************
84 *** OSStatus values unique to Security APIs ***
85 ***********************************************/
86
87 /*
88 Note: the comments that appear after these errors are used to create
89 SecErrorMessages.strings. The comments must not be multi-line, and
90 should be in a form meaningful to an end user. If a different or
91 additional comment is needed, it can be put in the header doc format,
92 or on a line that does not start with errZZZ.
93 */
94
95 CF_ENUM(OSStatus)
96 {
97 errSecSuccess = 0, /* No error. */
98 errSecUnimplemented = -4, /* Function or operation not implemented. */
99 errSecIO = -36, /*I/O error (bummers)*/
100 errSecOpWr = -49, /*file already open with with write permission*/
101 errSecParam = -50, /* One or more parameters passed to a function where not valid. */
102 errSecAllocate = -108, /* Failed to allocate memory. */
103 errSecUserCanceled = -128, /* User canceled the operation. */
104 errSecBadReq = -909, /* Bad parameter or invalid state for operation. */
105 errSecInternalComponent = -2070,
106 errSecNotAvailable = -25291, /* No keychain is available. You may need to restart your computer. */
107 errSecDuplicateItem = -25299, /* The specified item already exists in the keychain. */
108 errSecItemNotFound = -25300, /* The specified item could not be found in the keychain. */
109 errSecInteractionNotAllowed = -25308, /* User interaction is not allowed. */
110 errSecDecode = -26275, /* Unable to decode the provided data. */
111 errSecAuthFailed = -25293, /* The user name or passphrase you entered is not correct. */
112 };
113
114 CF_IMPLICIT_BRIDGING_DISABLED
115 CF_ASSUME_NONNULL_END
116
117 __END_DECLS
118
119 #endif /* !_SECURITY_SECBASE_H_ */