0

I've browsed through about 2 dozen articles here and elsewhere looking for an answer. No one seems to have addressed this problem --

We have an application that has fairly large database (on the order of 5MB). The application needs the DB when working offline. The DB can be recreated by downloading from our server when online.

We can't use Core Data instead of our own DB because the data must be encrypted to meet government privacy standards.

The app cannot function offline without this database, so it can't go into Library/Caches.

We can place the data in Documents and mark it "do not backup" for iOS 5, but this doesn't work for iOS 4 since that attribute is not recognized.

So what can we do with the database in iOS 4?

Hot Licks
  • 47,103
  • 17
  • 93
  • 151
  • So your requirements stipulate that not only must it be encrypted on the device, but it cannot be backed up to the computer when the device is sync'd? – QED Mar 06 '12 at 17:37
  • @psoft -- Nothing is stipulated about backup, other than the data to recreate is already backed up on our server. – Hot Licks Mar 06 '12 at 18:18
  • @HotLicks Can you expand on "encrypted to meet government privacy standards"? Is there a standard you can point to? – Peter M Mar 06 '12 at 19:11
  • Medical privacy standards. The data must be encrypted, not simply "safely stored". – Hot Licks Mar 06 '12 at 20:42

2 Answers2

0

Just off the top of my head.

I guess you could subclass NSManagedObject so that it encrypts any data that gets saved to Core Data and decrypts it when you read it. There will be a lot of overhead on the CPU though. There might be someway to optimize it.

Check this out: AES Encryption for an NSString on the iPhone

Community
  • 1
  • 1
Jiho Kang
  • 2,482
  • 1
  • 28
  • 38
  • 1
    Encrypting string by string is incredibly complicated and error prone, grossly inefficient, and seriously insecure. – Hot Licks Mar 06 '12 at 18:14
0

Put it in (sandbox)/Library/Application Support. Here is how Apple describes the Application Support folder:

Resource and data files that your app creates and manages for the user. You might use this directory to store app state information, computed or downloaded data, or even user created data that you manage on behalf of the user.

Quoted from Apple's File System Programming Guide for iOS.

bneely
  • 9,083
  • 4
  • 38
  • 46
  • Odd that Application Support isn't mentioned in any of the Data Storage Guidelines stuff. Given the time/cost associated with resubmitting (especially for us, given that our customer insists on doing the actual submissions), it would be nice to know for sure if this solution would be accepted. – Hot Licks Mar 06 '12 at 18:21