简体   繁体   English

如何保护应用程序文档目录中的文件免受外部工具(iFunbox / iTools等)的读取

[英]How can I protect my files in app's document directory from reading by external tools(iFunbox/iTools etc)

I want to develop an photo protected app. 我想开发一个受照片保护的应用程序。 When first launch, it forces user to input an password and every time back to the app, user must input the same password again. 首次启动时,它会强制用户输入密码,并且每次返回应用程序时,用户都必须再次输入相同的密码。 User takes photo in my app and I store the photo in app's document directory. 用户在我的应用程序中拍照,我将照片存储在应用程序的文档目录中。

It works well but someone can access content in the app's document through external tools like iFunbox, they can export the photos. 它运作良好,但有人可以通过iFunbox等外部工具访问应用程序文档中的内容,他们可以导出照片。 So my app is not safe enough. 因此我的应用程序不够安全。 I have considered that I can use ZipArchive to compress photos with an password when save photos and uncompress photos when using want to see the photos, but compressing and uncompressing will cost much time and battery, I think it is not an good idea. 我考虑过可以在保存照片时使用ZipArchive来使用密码压缩照片,而在想查看照片时可以使用解压缩照片,但是压缩和解压缩会花费很多时间和电池,我认为这不是一个好主意。

Can someone give me some suggestion? 有人可以给我一些建议吗? Thanks in advance. 提前致谢。

You can use the NSData writeToFile:options:error: with the option NSDataWritingFileProtectionComplete which will write it encrypted. 您可以将NSData writeToFile:options:error:与选项NSDataWritingFileProtectionComplete ,以加密方式将其写入。 This will only protect the files when the iOS device is locked. 仅在iOS设备锁定时,这将保护文件。

Alternatively you can encrypt the file yourself with CommonCrypto AES and save the key in the keychain. 或者,您可以使用CommonCrypto AES自己加密文件,然后将密钥保存在钥匙串中。

暂无
暂无

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

相关问题 如何使用iFunbox等工具保护我的iOS应用 - How can I protect my iOS app against tools like iFunbox 如何从其他iOS应用程序读取应用程序文档目录中的文档? - How can I read documents in my app's Document directory from other iOS apps? 如何使用cordova列出iOS应用程序文档目录中的文件? - How to list files from iOS app document directory using cordova? 如何使用iCloud在我的应用程序之间同步UIdocument文件(保存在本地文档目录中)? - How can I use iCloud to synchronize a UIdocument files (saved in local document directory) between my apps? 如何保护我的应用程序的某些部分免受某些用户的攻击(即某些用户只能看到其中一个选项卡式视图) - How can I protect a portion of my app from certain users (ie. one of the tabbed views can only be seen by certain users) 锁定/保护iOS应用程序的文档目录 - Lock/Protect document directory of ios app 如何从我的iPhone App文档目录中选择所有图像 - How to select all the images from my iPhone App document directory 在ios应用程序版本更新后,如何获取本地存储在应用程序文档目录中的文件? - How to get files which are locally stored in app's document directory after ios app version get update? iOS:当我从iMazing打开我的应用程序时,如何隐藏和保护读取并保护mac在特定文件夹上的副本? - iOS: When I open my app from iMazing, how to hide and protect from read and protect from copy on the mac a specific folder? 如何从我的应用程序打开手机的键盘 - How Can I open phone's keypad from my app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM