Reputation: 3331
I had a question about encryption and core data. Is there any way to encrypt the entries/entities in a core data store so any and all info in the db is encrypted and then decrypted when a fetch request using a controller such as NSFetchedResultsController is made?
I want to make sure though that operations such as search and sort on the db will be unaffected by the fact that the contents are encrypted
Upvotes: 1
Views: 1071
Reputation: 21902
CoreData supports Transformable attributes, which allow you to apply a transformation to the data as it gets loaded into the context. It's not quite what you are saying (because it only transforms field by field instead of the whole DB, but you might find it useful none-the-less). This is suited if only some fields need to be encrypted (credit card number for example)
Here's an example: https://artandlogic.com/2012/07/securing-your-core-data-with-transformable-attributes/
Upvotes: 3