2 // secd-83-item-match-trusted.m
7 * This is to fool os services to not provide the Keychain manager
8 * interface tht doens't work since we don't have unified headers
9 * between iOS and OS X. rdar://23405418/
11 #define __KEYCHAINCORE__ 1
13 #import <Foundation/Foundation.h>
14 #import <Security/SecItem.h>
15 #import <Security/SecBase.h>
16 #import <utilities/SecCFWrappers.h>
19 #import "secd_regressions.h"
20 #import "SecdTestKeychainUtilities.h"
21 #import "secd-83-item-match.h"
23 static void test(id returnKeyName) {
24 CFTypeRef result = NULL;
25 ok_status(SecItemCopyMatching( (__bridge CFDictionaryRef)@{ (id)kSecClass : (id)kSecClassCertificate,
26 (id)kSecMatchLimit : (id)kSecMatchLimitAll,
27 returnKeyName : @YES }, &result));
28 ok(result && CFArrayGetCount(result) == 6);
29 CFReleaseNull(result);
31 is_status(SecItemCopyMatching( (__bridge CFDictionaryRef)@{ (id)kSecClass : (id)kSecClassCertificate,
32 (id)kSecMatchLimit : (id)kSecMatchLimitAll,
33 (id)kSecMatchTrustedOnly : @YES,
34 returnKeyName : @YES }, &result), errSecItemNotFound);
35 CFReleaseNull(result);
38 int secd_83_item_match_trusted(int argc, char *const *argv)
40 secd_test_setup_temp_keychain(__FUNCTION__, NULL);
44 addTestCertificates();
45 NSArray *returnKeyNames = @[(id)kSecReturnAttributes, (id)kSecReturnData, (id)kSecReturnRef, (id)kSecReturnPersistentRef];
46 for (id returnKeyName in returnKeyNames)