tags:

views:

42

answers:

2

Hi,

I have several plist files in my app, that I want to be non human readable, or editable. The idea is to encode them using another app, then drop them in the normal iphone app just for decoding and processing.

I have drooped encryption because 1st, I don't need something with strong encryption, and 2nd because of the app store procedure for encrypted apps.

Can anyone suggest me how to proceed? What is the simplest (not the best in terms of encryption) method implement?

Please assist!

+1  A: 

iPhone applications are "sandboxed", meaning that applications cannot read each other's data; each application has associated with it its own username and group, along with its own set of folders that it owns. An application cannot access the folder or data of another iPhone application. Therefore, the requirement doesn't really make sense. You should simply use NSDictionary -writeToFile:atomically, and NSDictionary -initWithContentsOfFile to read/write the data to/from a PLIST. If you need to add encryption (because you are worried about two people sharing the iPhone, or something like that), then I suggest you encrypt the individual entries before placing them in the dictionary.

Edit
Based on your comment below, it appears that you are trying to prevent people from pirating your application, rather than trying to protect user data as the question implies. Unfortunately, it is always possible to pirate an application. Anything ranging from obfuscation to using certificates to asymmetric encryption to running a checksum over the application binary can all be bypassed or defeated. The best way to deter piracy is to have a quick iteration cycle and to place most of your data in the cloud, where it is frequently changed and updated, as doing so diminishes the value of any pirated snapshot of the application. That said, it is generally a good idea to consider software piracy as simply a cost of doing business. Most users will not pirate the application, and since all the various methods for protecting your application can (and will) be defeated, the costs of implementing such things is generally not worth it.

Michael Aaron Safyan
I am worried about using jailbreaken iphones to extract the contents of the plists, and building apps with exact same content... I need to simply scramble or protect the content from been used on another apps. Its many many months of work.
Bill
I think he's worrying about pirate developers stealing some custom content. That's a different and potentially more serious problem than pirate end users.
TechZen
A: 

Take a look at the NSDataWritingOptions of NSData. There is built in encryption for binary plist files. I've never used it so I don't know how easy it is for someone with developer's tools to defeat it. It should however provide protection against casual thievery.

However, if your worried about about other developers stealing your content, your best protection will be copyright. Copyright protects content, that's what its for. Make sure to include a copyright in the actual plist as part of the data. Stick a copyright in every resource file e.g. images.

TechZen
Thanks for the suggestion, I am looking into NSData....Regarding copyright, I cannot claim copyright because there is data collected from various sources...
Bill
Under US (and I believe EU) law you can copyright a database i.e. a particular assemblage of information. Even if the individual components of the data are in the public domain, you can copyright your uniques organization of them. For example, if you had database of log values, geographical coordinates etc, the individual values would be public domain but someone couldn't legally just copy your database and stick in their own app. Someone can independently reproduce their own database with their own data but they can't mine yours.
TechZen