加密或保护存储在iOS应用程序的NSDocumentsDirectory中的文件 [英] Encrypting or protecting files stored in iOS app's NSDocumentsDirectory

查看:187
本文介绍了加密或保护存储在iOS应用程序的NSDocumentsDirectory中的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的某个产品中有自定义要求,我需要保护或加密存储在NSDocumentsDirectory文件夹中的文件。即使这些文件被邮寄(应用程序有能力邮寄文件)给其他人,他或她将无法在不使用我的应用程序的情况下打开此文档(我将使用电子邮件附件的功能开放)。所以基本上只有应用程序可以访问所有这些文档,没有应用程序,文档应该只是垃圾。有没有办法做到这一点,或者之前有任何人做过。

I have a custom requirement in one of my products and I need to protect or encrypt files that are stored inside the NSDocumentsDirectory folder. Even if these documents are mailed (The app has the ability to mail documents) to some other person , he or she will not be able to open this document without using my app (I will be using open in functionality of email attachments). So basically only the application can access all these documents and without the app the documents should be mere junk. IS there any way to do it, or has any one done something before.

我也看到了这个但无法得到完整的想法。

I also saw this but could not get a complete idea.

推荐答案

如果您想要一种快速简便的方法来处理不需要严格安全性的数据,只需将文件压缩为固定的密码。

If you want a quick and easy method for data that doesn't need serious security, just zip the files with a fixed password.

ZipArchive是一个很好的库。

ZipArchive is a good library for this.

对于更严肃的方法,请检查 iOS - 使用自定义加密密钥保护文件?

For a more serious approach, check iOS - Protecting files with a custom encryption key?

这篇关于加密或保护存储在iOS应用程序的NSDocumentsDirectory中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆