From the course: iOS Development: Security
Unlock the full course today
Join today to access over 23,200 courses taught by industry experts.
Implementing a Keychain wrapper - iOS Tutorial
From the course: iOS Development: Security
Implementing a Keychain wrapper
- [Instructor] We continue with the pasteboard demo app. We're going to replace the user default based storage and rely on the keychain instead. The keychain API consists of C functions that are a bit verbose, so developers usually end up building convenience wrappers around it. Another option is to use a third party facade like Swift keychain wrapper. Alright, now let's switch back to Xcode. We're going to build our own keychain wrapper. So let's create a new file. I call it Keychain Facade. We need to import the security framework. Then, I declare the Keychain Facade class. First I'm going to set up the query dictionary. This dictionary describes this item to be handled by one of the keychain service's functions. The dictionary has a similar structure for the functions we're going to implement. So to avoid code application, I extract the dictionary set up code to a private method. I'm going to call it Setup Query Dictionary. The method takes an argument called Key of type string…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
Keychain overview1m
-
(Locked)
Implementing a Keychain wrapper3m 3s
-
(Locked)
Adding a value to the Keychain5m 9s
-
(Locked)
Using the Keychain wrapper4m 31s
-
(Locked)
Removing items from the Keychain3m 30s
-
(Locked)
Retrieve items from the Keychain4m 33s
-
(Locked)
Restore values from the Keychain2m 19s
-
-
-
-
-