/ OSX / codesign_tests / main.c
main.c
 1  //
 2  //  Copyright (c) 2011 Apple. All rights reserved.
 3  //
 4  
 5  #include <Security/Security.h>
 6  #include <Security/SecTask.h>
 7  #include <stdio.h>
 8  #include <err.h>
 9  
10  int main (int argc, const char * argv[])
11  {
12  	long num = 1000;
13  
14  	while (num-- > 0) {
15  		SecTaskRef secTask = SecTaskCreateFromSelf(NULL);
16  		if (secTask == NULL)
17  			errx(1, "SecTaskCreateFromSelf");
18  
19  		CFErrorRef error = NULL;
20  		CFTypeRef value = SecTaskCopyValueForEntitlement(secTask, CFSTR("com.apple.security.some-entitlement"), &error);
21  		if (value == NULL)
22  			errx(1, "SecTaskCopyValueForEntitlement");
23  
24  		if (num == 1)
25  			CFShow(value);
26  
27  		CFRelease(value);
28  		CFRelease(secTask);
29  	}
30  
31  	return 0;
32  }
33