MYKeychain.m
changeset 27 d0aadddb9c64
parent 16 c409dbc4f068
     1.1 --- a/MYKeychain.m	Tue Jun 02 13:16:28 2009 -0700
     1.2 +++ b/MYKeychain.m	Tue Jul 21 10:13:08 2009 -0700
     1.3 @@ -36,7 +36,7 @@
     1.4      SecIdentitySearchRef _searchRef;
     1.5  }
     1.6  
     1.7 -- (id) initWithKeychain: (MYKeychain*)keychain;
     1.8 +- (id) initWithKeychain: (MYKeychain*)keychain keyUsage: (CSSM_KEYUSE)keyUsage;
     1.9  @end
    1.10  
    1.11  
    1.12 @@ -269,7 +269,11 @@
    1.13  }
    1.14  
    1.15  - (NSEnumerator*) enumerateIdentities {
    1.16 -    return [[[MYIdentityEnumerator alloc] initWithKeychain: self] autorelease];
    1.17 +    return [self enumerateIdentitiesWithKeyUsage: 0];
    1.18 +}
    1.19 +
    1.20 +- (NSEnumerator*) enumerateIdentitiesWithKeyUsage: (CSSM_KEYUSE)keyUsage {
    1.21 +    return [[[MYIdentityEnumerator alloc] initWithKeychain: self keyUsage: keyUsage] autorelease];
    1.22  }
    1.23  
    1.24  - (NSEnumerator*) enumerateSymmetricKeys {
    1.25 @@ -448,10 +452,10 @@
    1.26  
    1.27  @implementation MYIdentityEnumerator
    1.28  
    1.29 -- (id) initWithKeychain: (MYKeychain*)keychain {
    1.30 +- (id) initWithKeychain: (MYKeychain*)keychain keyUsage: (CSSM_KEYUSE)keyUsage {
    1.31      self = [super init];
    1.32      if (self) {
    1.33 -        if (!check(SecIdentitySearchCreate(keychain.keychainRef, 0, &_searchRef),
    1.34 +        if (!check(SecIdentitySearchCreate(keychain.keychainRef, keyUsage, &_searchRef),
    1.35                     @"SecIdentitySearchCreate")) {
    1.36              [self release];
    1.37              return nil;