Securing xml plists in Cocoa / Objective C

天涯浪子 提交于 2019-11-28 18:52:24

There is no built-in encryption function in plist. Many people treats the compression as encryption.

Here is what I would do,

  1. Make up an encryption key.
  2. write a tiny program to encrypt the plist into a binary file using SecKeyEncrypt().
  3. Put the binary file in the bundle.
  4. In the app, hide the key somewhere. For example, store them as pieces so it's not easy to find from a dump.
  5. When you startup the app, read the binary file from bundle, decrypt it using SecKeyDecrypt() using the key and store the cleartext in memory.
  6. The cleartext is the plist and load the plist from the memory.

This is still considered obfuscating because key is available in your bundle but it will be hard enough to deter most casual hackers.

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