1 /* Copyright (c) 2012 Apple Inc. All Rights Reserved. */
3 #ifndef _SECURITY_AUTH_ITEMS_H_
4 #define _SECURITY_AUTH_ITEMS_H_
6 #include <Security/Authorization.h>
9 #if defined(__cplusplus)
27 #pragma mark auth_items_t
32 typedef bool (^auth_items_iterator_t
)(const char *key
);
33 #endif /* __BLOCKS__ */
35 CFTypeID
auth_items_get_type_id(void);
37 AUTH_WARN_RESULT AUTH_MALLOC AUTH_RETURNS_RETAINED
38 auth_items_t
auth_items_create(void);
40 AUTH_WARN_RESULT AUTH_MALLOC AUTH_NONNULL_ALL AUTH_RETURNS_RETAINED
41 auth_items_t
auth_items_create_with_xpc(const xpc_object_t data
);
43 AUTH_WARN_RESULT AUTH_MALLOC AUTH_NONNULL_ALL AUTH_RETURNS_RETAINED
44 auth_items_t
auth_items_create_copy(auth_items_t
);
46 AUTH_WARN_RESULT AUTH_NONNULL_ALL
47 size_t auth_items_get_count(auth_items_t
);
49 AUTH_WARN_RESULT AUTH_NONNULL_ALL
50 AuthorizationItemSet
* auth_items_get_item_set(auth_items_t
);
52 AUTH_WARN_RESULT AUTH_NONNULL_ALL
53 xpc_object_t
auth_items_export_xpc(auth_items_t
);
56 void auth_items_set_flags(auth_items_t
, const char *key
, uint32_t flags
);
59 void auth_items_clear_flags(auth_items_t
, const char *key
, uint32_t flags
);
61 AUTH_WARN_RESULT AUTH_NONNULL_ALL
62 uint32_t auth_items_get_flags(auth_items_t
, const char *key
);
65 bool auth_items_check_flags(auth_items_t
, const char *key
, uint32_t flags
);
68 void auth_items_set_key(auth_items_t
, const char *key
);
71 bool auth_items_exist(auth_items_t
, const char *key
);
74 void auth_items_remove(auth_items_t
, const char *key
);
77 void auth_items_remove_with_flags(auth_items_t
, uint32_t flags
);
80 void auth_items_clear(auth_items_t
);
83 void auth_items_copy(auth_items_t
, auth_items_t src
);
86 void auth_items_copy_xpc(auth_items_t
, const xpc_object_t src
);
89 void auth_items_copy_with_flags(auth_items_t
, auth_items_t src
, uint32_t flags
);
92 bool auth_items_iterate(auth_items_t
, auth_items_iterator_t iter
);
95 void auth_items_set_string(auth_items_t
, const char *key
, const char *value
);
97 AUTH_WARN_RESULT AUTH_NONNULL_ALL
98 const char * auth_items_get_string(auth_items_t
, const char *key
);
101 void auth_items_set_data(auth_items_t
, const char *key
, const void *value
, size_t len
);
103 AUTH_WARN_RESULT AUTH_NONNULL_ALL
104 const void * auth_items_get_data(auth_items_t
, const char *key
, size_t * len
);
106 AUTH_WARN_RESULT AUTH_NONNULL_ALL
107 const void * auth_items_get_data_with_flags(auth_items_t items
, const char *key
, size_t *len
, uint32_t flags
);
110 void auth_items_set_bool(auth_items_t
, const char *key
, bool value
);
112 AUTH_WARN_RESULT AUTH_NONNULL_ALL
113 bool auth_items_get_bool(auth_items_t
, const char *key
);
116 void auth_items_set_int(auth_items_t
, const char *key
, int32_t value
);
118 AUTH_WARN_RESULT AUTH_NONNULL_ALL
119 int32_t auth_items_get_int(auth_items_t
, const char *key
);
122 void auth_items_set_uint(auth_items_t
, const char *key
, uint32_t value
);
124 AUTH_WARN_RESULT AUTH_NONNULL_ALL
125 uint32_t auth_items_get_uint(auth_items_t
, const char *key
);
128 void auth_items_set_int64(auth_items_t
, const char *key
, int64_t value
);
130 AUTH_WARN_RESULT AUTH_NONNULL_ALL
131 int64_t auth_items_get_int64(auth_items_t
, const char *key
);
134 void auth_items_set_uint64(auth_items_t
, const char *key
, uint64_t value
);
136 AUTH_WARN_RESULT AUTH_NONNULL_ALL
137 uint64_t auth_items_get_uint64(auth_items_t
, const char *key
);
140 void auth_items_set_double(auth_items_t
, const char *key
, double value
);
142 AUTH_WARN_RESULT AUTH_NONNULL_ALL
143 double auth_items_get_double(auth_items_t
, const char *key
);
145 AUTH_WARN_RESULT AUTH_NONNULL_ALL
146 uint32_t auth_items_get_type(auth_items_t
, const char *key
);
148 AUTH_WARN_RESULT AUTH_NONNULL_ALL
149 size_t auth_items_get_length(auth_items_t
, const char *key
);
152 void auth_items_set_value(auth_items_t
, const char *key
, uint32_t type
, uint32_t flags
, const void *value
, size_t len
);
155 #pragma mark auth_rights_t
159 AUTH_WARN_RESULT AUTH_MALLOC AUTH_RETURNS_RETAINED
160 auth_rights_t
auth_rights_create(void);
162 AUTH_WARN_RESULT AUTH_MALLOC AUTH_RETURNS_RETAINED
163 auth_rights_t
auth_rights_create_with_xpc(const xpc_object_t data
);
165 AUTH_WARN_RESULT AUTH_NONNULL_ALL
166 xpc_object_t
auth_rights_export_xpc(auth_rights_t
);
169 void auth_rights_set_flags(auth_rights_t
, const char *key
, uint32_t flags
);
172 void auth_rights_clear_flags(auth_rights_t
, const char *key
, uint32_t flags
);
174 AUTH_WARN_RESULT AUTH_NONNULL_ALL
175 uint32_t auth_rights_get_flags(auth_rights_t
, const char *key
);
178 bool auth_rights_check_flags(auth_rights_t
, const char *key
, uint32_t flags
);
180 AUTH_WARN_RESULT AUTH_NONNULL_ALL
181 size_t auth_rights_get_count(auth_rights_t
);
184 void auth_rights_add(auth_rights_t
, const char *key
);
187 bool auth_rights_exist(auth_rights_t
, const char *key
);
190 void auth_rights_remove(auth_rights_t
, const char *key
);
193 void auth_rights_clear(auth_rights_t
);
196 bool auth_rights_iterate(auth_rights_t rights
, bool(^iter
)(const char * key
));
198 #if defined(__cplusplus)
202 #endif /* !_SECURITY_AUTH_ITEMS_H_ */