1 /* Copyright (c) 2012 Apple Inc. All rights reserved. */
3 #ifndef _SECURITY_AUTH_AGENT_H_
4 #define _SECURITY_AUTH_AGENT_H_
6 #if defined(__cplusplus)
10 typedef enum _PluginState
{
28 // Unified reason codes transmitted to SecurityAgent (and internationalized there)
31 noReason
= 0, // no reason (not used, used as a NULL)
32 unknownReason
, // something else (catch-all internal error)
34 // reasons for asking for a new passphrase
35 newDatabase
= 11, // need passphrase for a new database
36 changePassphrase
, // changing passphrase for existing database
38 // reasons for retrying an unlock query
39 invalidPassphrase
= 21, // passphrase was wrong
41 // reasons for retrying a new passphrase query
42 passphraseIsNull
= 31, // empty passphrase
43 passphraseTooSimple
, // passphrase is not complex enough
44 passphraseRepeated
, // passphrase was used before (must use new one)
45 passphraseUnacceptable
, // passphrase unacceptable for some other reason
46 oldPassphraseWrong
, // the old passphrase given is wrong
48 // reasons for retrying an authorization query
49 userNotInGroup
= 41, // authenticated user not in needed group
50 unacceptableUser
, // authenticated user unacceptable for some other reason
52 // reasons for canceling a staged query
53 tooManyTries
= 61, // too many failed attempts to get it right
54 noLongerNeeded
, // the queried item is no longer needed
55 keychainAddFailed
, // the requested itemed couldn't be added to the keychain
56 generalErrorCancel
, // something went wrong so we have to give up now
67 AUTH_WARN_RESULT AUTH_MALLOC AUTH_NONNULL_ALL AUTH_RETURNS_RETAINED
68 agent_t
agent_create(engine_t engine
, mechanism_t mech
, auth_token_t auth
, process_t proc
, bool firstMech
);
71 uint64_t agent_run(agent_t
,auth_items_t hints
, auth_items_t context
, auth_items_t immutable_hints
);
74 auth_items_t
agent_get_hints(agent_t
);
77 auth_items_t
agent_get_context(agent_t
);
80 void agent_deactivate(agent_t
);
83 void agent_destroy(agent_t
);
86 PluginState
agent_get_state(agent_t
);
89 mechanism_t
agent_get_mechanism(agent_t
);
92 void agent_recieve(agent_t
);
96 agent_notify_interrupt(agent_t agent
);
100 agent_clear_interrupt(agent_t agent
);
102 #if defined(__cplusplus)
106 #endif /* !_SECURITY_AUTH_AGENT_H_ */