Encrypting or protecting files stored in iOS app's NSDocumentsDirectory

陌路散爱 提交于 2019-12-25 04:55:19

问题


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.


回答1:


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 is a good library for this.

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




回答2:


The other post you mentioned works on the concept of password protecting the files, I had encountered the same issue that was for my custom defined files in which our team, encoded the contents of the file on random locations, and saved it. Only our Application could decode it correctly as we had the key :)

It was a windows application, It would work here also.



来源:https://stackoverflow.com/questions/16175846/encrypting-or-protecting-files-stored-in-ios-apps-nsdocumentsdirectory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!