tags:

views:

19

answers:

1

I'm creating a MonoTouch app that has some declarative business logic that the client doesn't want to be easily retrieved. Obviously, there's the usual argument that nothing in software can every be protected, but the client would prefer that it not be trivially easy to do.

I could encode the logic as C#, but it's cleaner if I could have it as an XML document or SQLite database (or other).

Is there a way of having an XML document or SQLite database embedded into the compiled code?

Failing that, has anyone tried encrypting XML files or SQLite databases (or another declarative technology) in MonoTouch apps and can point me in the right direction. I'm guessing it might be straightforward to decrypt an XML file, but it wouldn't surprise me if there a "gotcha" with doing this on the iPhone.

+1  A: 

I've done this recently with an application that uses XmlSerialization. I used Rijndael (this one) to encrypt the data, which is saved to disk. Obviously the key is still visible in the binary for the most dedicated intruder, but for most it makes it difficult to casually view the XML.

In your case, you could do this and then add the XML file an embedded resource. I'm not sure how Monotouch implements embedded resources but they're fast to load.

Chris S