From the course: Writing Secure Code in iOS by Infosec

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Data persistence, part 2

Data persistence, part 2

- Data persistence, part two. Now we have Keychain. This is an encrypted local database with a really good API. It is the preferred mechanism in iOS for saving sensitive data locally. Now that said, the preferred thing is to not save anything sensitive locally at all. The preferred thing is to save it to the cloud to save it to a server where you can have a whole lot more security on it. However, if you do have to save something locally, like some passwords and things, yeah, Keychain is the place to put it. It can store keys that are obtained through other methods. It's used to save cryptographic keys, credentials, secure notes, certificates, any sensitive data, credit card numbers, bank account numbers if you need to save them locally. Here would be a snippet for creating a Keychain. You create a query dictionary that contains and describes the item you're going to store. So we say a key is, and then whatever that string, that key is. And then you can have tags to help differentiate…

Contents