KudoCC
KudoCC

Reputation: 6952

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. 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.

Can someone give me some suggestion? Thanks in advance.

Upvotes: 0

Views: 455

Answers (1)

zaph
zaph

Reputation: 112857

You can use the NSData writeToFile:options:error: with the option NSDataWritingFileProtectionComplete which will write it encrypted. This will only protect the files when the iOS device is locked.

Alternatively you can encrypt the file yourself with CommonCrypto AES and save the key in the keychain.

Upvotes: 1

Related Questions