Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable data protection to protect data at rest #20

Closed
whaber opened this issue Aug 27, 2020 · 1 comment
Closed

Enable data protection to protect data at rest #20

whaber opened this issue Aug 27, 2020 · 1 comment
Labels

Comments

@whaber
Copy link
Contributor

whaber commented Aug 27, 2020

The Data Protection entitlement is not enabled within the Xcode project for the App. When enabled, the Data Protection capability will automatically protect all files created by the App with the strongest Data Protection class, NSFileProtectionComplete; this protection class ensures that the file is encrypted with the user's passcode whenever the device is locked.

As described in the iOS Security Guide in the "Data Protection" section, the default Data Protection class for files since iOS 7 is NSFileProtectionCompleteUntilFirstUserAuthentication, which only encrypts the user's data until the very first time they unlock their device:

Enable the Data Protection entitlement in the Xcode project configuration of the App. As shown in the screenshot, this setting is available in the "Capabilities" tab within Xcode.
Because the entitlement will cause iOS to encrypt all the App's files when the device is locked, it might cause problems if the App tries to access its files while running in the background (ie. when the device might be locked). To work around this problem, App can lower the protection level to NSFileProtectionCompleteUntilFirstUserAuthentication for the specific files that need to be accessed while in the background, as described in the Encrypting Your App's Files article within the Apple documentation.

Lastly, the applicationProtectedDataWillBecomeUnavailable: and applicationProtectedDataDidBecomeAvailable: App delegate methods can be used to manage the App's access to protected files.

@whaber whaber added security enhancement New feature or request labels Aug 27, 2020
@github-actions
Copy link

This issue is stale because it has been open for 14 days with no
activity. It will automatically close after 7 more days of inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant