1

Has anyone used encryption on their Core Data SQLite stores? And how did you implement it?

jscs
  • 63,694
  • 13
  • 151
  • 195
the Reverend
  • 12,305
  • 10
  • 66
  • 121

2 Answers2

2

I'm beginning including this wonderful project:

https://github.com/project-imas/encrypted-core-data

On my code, all things goes well. I have a strange problem only using NSPredicate to create a search query in related fields.

ndman
  • 153
  • 8
2

I'm pretty sure the only way to use encryption in Core Data is to either encrypt the entire persistent store file when the app quits or to use custom accessors in managed object subclasses to encrypt and decrypt data as they are individually saved to the persistent store.

TechZen
  • 64,370
  • 15
  • 118
  • 145
  • I think your second option would be by far the best. – Rob Keniger Jun 09 '11 at 06:17
  • Thanks. - How much impact on performance do you think it will have? – the Reverend Jun 09 '11 at 13:52
  • I think the performance penalty would be substantial. Encryption algorithms are computationally intensive and you would be running encryption every time you get or set an attribute. In the end, it would depend on the size of your data. If you data set is relatively small, Core Data operations would appear instantaneous to the user regardless of how complex they were but when you start talking about thousands of active objects and thousands of updates then any slow down begins to build upon itself and become noticeable. – TechZen Jun 09 '11 at 16:35
  • 1
    The Apple Security framework will let you protect relative small amounts of data so if your just saving small bits of data e.g. login names or passwords, you should use that instead of overloading the entire Core Data stack. – TechZen Jun 09 '11 at 16:36