Tutorial by Examples

Every Keychain Item is most often represented as a CFDictionary. You can, however, simply use NSDictionary in Objective-C and take advantage of bridging, or in Swift you may use Dictionary and explicitly cast to CFDictionary. You could construct a password with the following dictionary: Swift var...
To construct a query, we need to represent it as a CFDictionary. You may also use NSDictionary in Objective-C or Dictionary in Swift and cast to CFDictionary. We need a class key: Swift var dict = [String : AnyObject]() dict[kSecClass as String] = kSecClassGenericPassword Next, we can specify...
As usual, we first need a CFDictionary to represent the item we want to update. This must contain all of the old values for the item, including the old private data. Then it takes a CFDictionary of any attributes or the data itself that you would like to change. So first, let's construct a class ke...
We need only one thing in order to delete an item from the Keychain: a CFDictionary with attributes describing the items to be deleted. Any items that match the query dictionary will be deleted permanently, so if you are only intending to delete a single item be sure to be specific with your query. ...
Keychain.h #import <Foundation/Foundation.h> typedef void (^KeychainOperationBlock)(BOOL successfulOperation, NSData *data, OSStatus status); @interface Keychain : NSObject -(id) initWithService:(NSString *) service_ withGroup:(NSString*)group_; -(void)insertKey:(NSString *)key with...
Keychain allows to save items with special SecAccessControl attribute which will allow to get item from Keychain only after user will be authenticated with Touch ID (or passcode if such fallback is allowed). App is only notified whether the authentication was successful or not, whole UI is managed b...

Page 1 of 1