iPhone Keychain Questions

Posted by AO on Stack Overflow See other posts from Stack Overflow or by AO
Published on 2010-03-08T13:02:26Z Indexed on 2010/03/08 13:06 UTC
Read the original article Hit count: 691

Filed under:
|
|
|

Some questions:
* Is there some way to view the data present in the iPhone keychain?
* The items an application adds, cannot be accessed by any other application, can it?
* What is the purpose of the identifier and access group in the initialization? My guess is that the identifier is simply used to find items but I'm a little bit unsure of the access group. If the access group is assigned nil, all applications can access the items? If the access group is assigned X, could the items be accessed by another application with the same string X as access group or what is the purpose of the access group in this case?
* Is the data in the keychain removed when the application is removed? If not, how do I achieve that?

And finally:

I can't get the KeychainItemWrapper (Apple example) to work. I've added the KeychainItemWrapper files to my project and when running it on the phone, an exception is thrown by SecItemAdd, saying that one or more parameters were not valid (result code -50). The code triggering the SecItemAdd follows:

KeychainItemWrapper* wrapper = [[KeychainItemWrapper alloc] initWithIdentifier:@"something" accessGroup:@"com.company.whatever"];
[wrapper setObject:@"this is my password" forKey:@"password"];
NSLog(@"Password: %@", [wrapper objectForKey:@"password"]);

The code can be found at http://developer.apple.com/iphone/library/samplecode/GenericKeychain/index.html

© Stack Overflow or respective owner

Related posts about iphone

Related posts about keychain