I want my CoreData file to be accessible only when device is in foreground in iOS5+ .(According to the WWDC 2011 Lecture#208) I have set the entitlement as in How do I add Data Protection Class Entitlements to my iOS 5 app. It works only if device is locked with passcode.
Is iOS provides any API to lock/encrypt the data as app goes to background (even if user passcode isn’t setup)
I want my CoreData file to be accessible only when device is in foreground
Share
The Data Protection feature of iOS uses the user’s passcode in order to derive its encryption keys. So, if there’s no passcode, there’s no Data Protection.
If you really need to encrypt the user’s data even in the absence of a passcode, you will have to do it yourself. Which, crucially, means managing your own encryption keys. This is highly likely to be less secure than Apple’s solution unless you happen to be a crypto expert.
Could you explain why you need the data to be encrypted in the way you’ve described? It would be easier then to suggest alternatives.