]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * Copyright (c) 2008,2012-2016 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 | #ifndef _SECURITY_SECTASK_H_ | |
25 | #define _SECURITY_SECTASK_H_ | |
26 | ||
27 | #include <Security/SecBase.h> | |
28 | ||
29 | #include <CoreFoundation/CoreFoundation.h> | |
30 | #include <mach/message.h> | |
31 | ||
32 | #if SEC_OS_IPHONE_INCLUDES | |
33 | #include <sys/cdefs.h> | |
34 | #endif | |
35 | ||
36 | #if SEC_OS_OSX | |
37 | #include <Security/SecCode.h> | |
38 | #endif /* SEC_OS_OSX */ | |
39 | ||
40 | __BEGIN_DECLS | |
41 | ||
42 | CF_ASSUME_NONNULL_BEGIN | |
43 | CF_IMPLICIT_BRIDGING_ENABLED | |
44 | ||
45 | /*! | |
46 | @typedef SecTaskRef | |
47 | @abstract CFType used for representing a task | |
48 | */ | |
49 | typedef struct CF_BRIDGED_TYPE(id) __SecTask *SecTaskRef; | |
50 | ||
51 | /*! | |
52 | @function SecTaskGetTypeID | |
53 | @abstract Returns the type ID for CF instances of SecTask. | |
54 | @result A CFTypeID for SecTask | |
55 | */ | |
56 | CFTypeID SecTaskGetTypeID(void); | |
57 | ||
58 | /*! | |
59 | @function SecTaskCreateWithAuditToken | |
60 | @abstract Create a SecTask object for the task that sent the mach message | |
61 | represented by the audit token. | |
62 | @param token The audit token of a mach message | |
63 | @result The newly created SecTask object or NULL on error. The caller must | |
64 | CFRelease the returned object. | |
65 | */ | |
66 | __nullable | |
67 | SecTaskRef SecTaskCreateWithAuditToken(CFAllocatorRef __nullable allocator, audit_token_t token); | |
68 | ||
69 | /*! | |
70 | @function SecTaskCreateFromSelf | |
71 | @abstract Create a SecTask object for the current task. | |
72 | @result The newly created SecTask object or NULL on error. The caller must | |
73 | CFRelease the returned object. | |
74 | #ifndef LEFT | |
75 | */ | |
76 | __nullable | |
77 | SecTaskRef SecTaskCreateFromSelf(CFAllocatorRef __nullable allocator); | |
78 | ||
79 | /*! | |
80 | @function SecTaskCopyValueForEntitlement | |
81 | @abstract Returns the value of a single entitlement for the represented | |
82 | task. | |
83 | @param task A previously created SecTask object | |
84 | @param entitlement The name of the entitlement to be fetched | |
85 | @param error On a NULL return, this may be contain a CFError describing | |
86 | the problem. This argument may be NULL if the caller is not interested in | |
87 | detailed errors. | |
88 | @result The value of the specified entitlement for the process or NULL if | |
89 | the entitlement value could not be retrieved. The type of the returned | |
90 | value will depend on the entitlement specified. The caller must release | |
91 | the returned object. | |
92 | @discussion A NULL return may indicate an error, or it may indicate that | |
93 | the entitlement is simply not present. In the latter case, no CFError is | |
94 | returned. | |
95 | */ | |
96 | __nullable | |
97 | CFTypeRef SecTaskCopyValueForEntitlement(SecTaskRef task, CFStringRef entitlement, CFErrorRef *error); | |
98 | ||
99 | /*! | |
100 | @function SecTaskCopyValuesForEntitlements | |
101 | @abstract Returns the values of multiple entitlements for the represented | |
102 | task. | |
103 | @param task A previously created SecTask object | |
104 | @param entitlements An array of entitlement names to be fetched | |
105 | @param error On a NULL return, this will contain a CFError describing | |
106 | the problem. This argument may be NULL if the caller is not interested in | |
107 | detailed errors. If a requested entitlement is not present for the | |
108 | returned dictionary, the entitlement is not set on the task. The caller | |
109 | must CFRelease the returned value | |
110 | */ | |
111 | __nullable | |
112 | CFDictionaryRef SecTaskCopyValuesForEntitlements(SecTaskRef task, CFArrayRef entitlements, CFErrorRef *error); | |
113 | ||
114 | /*! | |
115 | @function SecTaskCopySigningIdentifier | |
116 | @abstract Return the value of the codesigning identifier. | |
117 | @param task A previously created SecTask object | |
118 | @param error On a NULL return, this will contain a CFError describing | |
119 | the problem. This argument may be NULL if the caller is not interested in | |
120 | detailed errors. The caller must CFRelease the returned value | |
121 | */ | |
122 | __nullable | |
123 | CFStringRef SecTaskCopySigningIdentifier(SecTaskRef task, CFErrorRef *error); | |
124 | ||
125 | #if SEC_OS_IPHONE | |
126 | /*! | |
127 | @function SecTaskGetCodeSignStatus | |
128 | @abstract Return the code sign status flags | |
129 | @param task A previously created SecTask object | |
130 | */ | |
131 | ||
132 | uint32_t SecTaskGetCodeSignStatus(SecTaskRef task); | |
133 | #endif /* SEC_OS_IPHONE */ | |
134 | ||
135 | ||
136 | CF_IMPLICIT_BRIDGING_DISABLED | |
137 | CF_ASSUME_NONNULL_END | |
138 | ||
139 | __END_DECLS | |
140 | ||
141 | #endif /* !_SECURITY_SECTASK_H_ */ |