]>
git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_keychain/regressions/kc-02-unlock-noui.c
1 #include <Security/SecKeychain.h>
2 #include <Security/SecKeychainPriv.h>
4 #include "keychain_regressions.h"
5 #include "kc-helpers.h"
7 int kc_02_unlock_noui(int argc
, char *const *argv
)
11 initializeKeychainTests(__FUNCTION__
);
13 ok_status(SecKeychainSetUserInteractionAllowed(FALSE
), "SecKeychainSetUserInteractionAllowed(FALSE)");
15 SecKeychainRef keychain
= createNewKeychain("test", "test");
16 ok_status(SecKeychainLock(keychain
), "SecKeychainLock");
18 is_status(SecKeychainUnlock(keychain
, 0, NULL
, FALSE
), errSecAuthFailed
, "SecKeychainUnlock");
20 checkPrompts(0, "Unexpected keychain access prompt unlocking after SecKeychainCreate");
22 ok_status(SecKeychainLock(keychain
), "SecKeychainLock");
25 ok_status(SecKeychainOpen("test", &keychain
), "SecKeychainOpen locked kc");
27 is_status(SecKeychainUnlock(keychain
, 0, NULL
, FALSE
), errSecAuthFailed
, "SecKeychainUnlock");
29 checkPrompts(0, "Unexpected keychain access prompt unlocking after SecKeychainCreate");
31 ok_status(SecKeychainDelete(keychain
), "%s: SecKeychainDelete", testName
);