Last active
August 29, 2015 14:02
-
-
Save jjgod/f7179a0a658b2ea1c624 to your computer and use it in GitHub Desktop.
Build with `clang -framework CoreFoundation -Wall -framework Security KeychainTest.c -o kctest`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/param.h> | |
#include <Security/Security.h> | |
static void displayName(const void *value, void *context) | |
{ | |
SecKeychainRef keychain = (SecKeychainRef) value; | |
UInt32 pathLength = MAXPATHLEN; | |
char pathName[MAXPATHLEN + 1]; | |
SecKeychainGetPath(keychain, &pathLength, pathName); | |
printf(" \"%*s\"\n", (int)pathLength, pathName); | |
} | |
int main() { | |
CFArrayRef searchList = NULL; | |
SecKeychainCopySearchList(&searchList); | |
CFRange range = { 0, CFArrayGetCount(searchList) }; | |
CFArrayApplyFunction(searchList, range, displayName, NULL); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment