MYKeychainItem.m
changeset 24 6856e071d25a
parent 23 39fec79de6e8
child 26 d9c2a06d4e4e
     1.1 --- a/MYKeychainItem.m	Sun Jun 07 21:53:56 2009 -0700
     1.2 +++ b/MYKeychainItem.m	Tue Jun 09 23:58:03 2009 -0700
     1.3 @@ -68,13 +68,6 @@
     1.4      return $array((id)_itemRef);
     1.5  }
     1.6  
     1.7 -#if MYCRYPTO_USE_IPHONE_API
     1.8 -- (CFDictionaryRef) asQuery {
     1.9 -    return (CFDictionaryRef) $dict( {(id)kSecClass, (id)kSecClassKey},//FIX
    1.10 -                                    {(id)kSecMatchItemList, self._itemList} );
    1.11 -}
    1.12 -#endif
    1.13 -
    1.14  
    1.15  - (MYKeychain*) keychain {
    1.16  #if MYCRYPTO_USE_IPHONE_API
    1.17 @@ -95,7 +88,7 @@
    1.18  - (BOOL) removeFromKeychain {
    1.19      OSStatus err;
    1.20  #if MYCRYPTO_USE_IPHONE_API
    1.21 -    err = SecItemDelete(self.asQuery);
    1.22 +    err = SecItemDelete((CFDictionaryRef) $dict( {(id)kSecValueRef, (id)_itemRef} ));
    1.23  #else
    1.24      err = SecKeychainItemDelete((SecKeychainItemRef)_itemRef);
    1.25      if (err==errSecInvalidItemRef)
    1.26 @@ -127,8 +120,7 @@
    1.27  + (NSData*) _getAttribute: (SecKeychainAttrType)attr ofItem: (MYKeychainItemRef)item {
    1.28      NSData *value = nil;
    1.29  #if MYCRYPTO_USE_IPHONE_API
    1.30 -    NSDictionary *info = $dict( {(id)kSecClass, (id)kSecClassKey},
    1.31 -                                {(id)kSecMatchItemList, $array((id)item)},
    1.32 +    NSDictionary *info = $dict( {(id)kSecValueRef, (id)item},
    1.33                                  {(id)kSecReturnAttributes, $true} );
    1.34      CFDictionaryRef attrs;
    1.35      if (!check(SecItemCopyMatching((CFDictionaryRef)info, (CFTypeRef*)&attrs), @"SecItemCopyMatching"))
    1.36 @@ -182,9 +174,7 @@
    1.37  {
    1.38  #if MYCRYPTO_USE_IPHONE_API
    1.39      id value = stringValue ?(id)stringValue :(id)[NSNull null];
    1.40 -    NSDictionary *query = $dict({(id)kSecClass, (id)kSecClassKey},
    1.41 -                                {(id)kSecAttrKeyType, (id)attr},
    1.42 -                                {(id)kSecMatchItemList, $array((id)item)});
    1.43 +    NSDictionary *query = $dict({(id)kSecValueRef, (id)item});
    1.44      NSDictionary *attrs = $dict({(id)attr, value});
    1.45      return check(SecItemUpdate((CFDictionaryRef)query, (CFDictionaryRef)attrs), @"SecItemUpdate");
    1.46