Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Core Data encryption [closed]

I have been encrypting core-data fields using 'SecKeyWrapper' class provided in one of Apple's document. The SecKeyWrapper class is non-ARC. I'm wondering if this is still the best way to encrypt core-data fields or is there newer/better solution available ?

Thank you

like image 257
user390687 Avatar asked Apr 21 '14 16:04

user390687


People also ask

Is iOS data encrypted at rest?

Similar to other full-disk encryptions, iPhone encryption also protects data that is at rest. This means that all the data that is stored in the device is protected when the device is not in use.

Does iOS encrypt data by default?

Yes. Apple's iPhone, iPod touch, and iPad smart devices all support basic built-in encryption while a passcode is enabled. Macs also support their own form of data encryption. The encryption on Apple's iOS and iPadOS devices, such as the iPhone, iPod touch, and iPad, is called Data Protection.

Does Core Data use encryption?

Core Data doesn't encrypt the data you store in the persistent store, but it is possible to enable encryption.

How do I turn off data encryption?

To disable data encryptionIn the Search box, enter Data Encryption Management, and then choose the related link. On the Home tab, in the Process group, choose Disable Encryption.


1 Answers

In iOS 5 and later Core Data by default uses NSFileProtection to protect persisted data.

For apps built for iOS 5.0 or later, persistent stores now store data by default in an encrypted format on disk. The default protection level prevents access to the data until after the user unlocks the device for the first time. You can change the protection level by assigning a custom value to the NSPersistentStoreFileProtectionKey key when configuring your persistent stores. For additional information about the data protection that are new in iOS 5.0, see “Data Protection Improvements.”

If you want to modify the default file protection behavior for your Core Data store, change the value for the key NSPersistentStoreFileProtectionKey to a different NSFileProtectionKey value in your store options dictionary.

Example:

NSDictionary *storeOptions = @{NSPersistentStoreFileProtectionKey  : NSFileProtectionComplete};

if (![coordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:[self storeURL] options:storeOptions error:&error]){
     [self presentError:error];
 }
like image 198
quellish Avatar answered Sep 22 '22 15:09

quellish