简体   繁体   English

如果尚未启用用户密码锁,我如何使用iOS磁盘加密保护数据?

[英]How can I protect data using iOS on-disk encryption when the user passcode lock has not been enabled?

Question

How can I ensure data is encrypted when using NSData.writeToFile:options:error: with the NSDataWritingFileProtectionComplete ? 使用NSData.writeToFile时,如何确保数据已加密:options:error:使用NSDataWritingFileProtectionComplete

Background research: Enabling data encyption 背景研究:启用数据加密

According to Apple documentation: 根据Apple文档:

Data protection is available on most iOS devices and is subject to the following requirements: 大多数iOS设备都提供数据保护,并且符合以下要求:

  • The file system on the user's device must support data protection. 用户设备上的文件系统必须支持数据保护。 This is true for newer devices, but for some earlier devices, the user might have to reformat the device's disk and restore any content from a backup. 这适用于较新的设备,但对于某些早期设备,用户可能必须重新格式化设备的磁盘并从备份中恢复任何内容。

  • The user must have an active passcode lock set for the device. 用户必须为设备设置活动密码锁。

https://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/AdvancedAppTricks/AdvancedAppTricks.html#//apple_ref/doc/uid/TP40007072-CH7-SW11 https://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/AdvancedAppTricks/AdvancedAppTricks.html#//apple_ref/doc/uid/TP40007072-CH7-SW11

The requirements state that user must activate passcode lock for the device, this is reinforced by the following end user documentation: 要求声明用户必须为设备激活密码锁,以下最终用户文档强调了这一点:

Enable data protection by configuring a passcode for your device: 通过为您的设备配置密码来启用数据保护:

  1. Tap Settings > General > Passcode. 点按设置>常规>密码。
  2. Follow the prompts to create a passcode. 按照提示创建密码。
  3. After the passcode is set, scroll down to the bottom of the screen and verify that the text "Data protection is enabled" is visible. 设置密码后,向下滚动到屏幕底部并确认可以看到“数据保护已启用”文本。

密码锁定屏幕

http://support.apple.com/kb/HT4175 http://support.apple.com/kb/HT4175

Similar SO Questions: 类似的SO问题:

How can I find out if the iPhone user currently has a passcode set and encryption enabled? 如何确定iPhone用户当前是否设置了密码并启用加密? seems like the answer to this question is no longer valid. 似乎这个问题的答案不再有效。

The requirements state that user must activate passcode lock for the device, this is reinforced by the following end user documentation. 要求声明用户必须激活设备的密码锁定,这由以下最终用户文档强化。

If user doesn't have any passcode enabled the encryption would be useless. 如果用户没有启用任何密码,则加密将毫无用处。 The unwanted user can use the app directly then anyway. 不受欢迎的用户无论如何都可以直接使用该应用程序。


A solution for your problem would be to manually implement encryption for app data and use a app specific password which you ask the user on every app launch. 针对您的问题的解决方案是手动实施应用数据加密,并使用您在每次启动应用时询问用户的应用专用密码。

I've seen that system at an online banking software for iOS, but I wouldn't recommend that system since it is very annoying for the user. 我在iOS的在线银行软件上看过这个系统,但我不推荐这个系统,因为它对用户来说非常烦人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM