MYKey-iPhone.m
changeset 25 38c3c3923e1f
parent 23 39fec79de6e8
child 26 d9c2a06d4e4e
     1.1 --- a/MYKey-iPhone.m	Sun Jun 07 21:53:56 2009 -0700
     1.2 +++ b/MYKey-iPhone.m	Wed Jun 10 09:02:18 2009 -0700
     1.3 @@ -59,7 +59,7 @@
     1.4  
     1.5  
     1.6  - (id) initWithKeyRef: (SecKeyRef)key {
     1.7 -    return [super initWithKeychainItemRef: (SecKeychainItemRef)key];
     1.8 +    return [self initWithKeychainItemRef: (SecKeychainItemRef)key];
     1.9  }
    1.10  
    1.11  
    1.12 @@ -114,7 +114,8 @@
    1.13          return nil;
    1.14      else {
    1.15          Assert(data!=NULL);
    1.16 -        return [(id)CFMakeCollectable(data) autorelease];
    1.17 +        _keyData = NSMakeCollectable(data);
    1.18 +        return _keyData;
    1.19      }
    1.20      // The format of this data is not documented. There's been some reverse-engineering:
    1.21      // https://devforums.apple.com/message/32089#32089
    1.22 @@ -147,9 +148,7 @@
    1.23  - (BOOL) setValue: (NSString*)value ofAttribute: (SecKeychainAttrType)attribute {
    1.24      if (!value)
    1.25          value = (id)[NSNull null];
    1.26 -    NSDictionary *query = $dict( {(id)kSecClass, (id)kSecClassKey},
    1.27 -                                {(id)kSecAttrKeyClass, (id)self.keyClass},
    1.28 -                                {(id)kSecMatchItemList, self._itemList} );
    1.29 +    NSDictionary *query = $dict( {(id)kSecValueRef, (id)self.keyRef} );
    1.30      NSDictionary *attrs = $dict( {(id)attribute, value} );
    1.31      return check(SecItemUpdate((CFDictionaryRef)query, (CFDictionaryRef)attrs), @"SecItemUpdate");
    1.32  }