Reputation: 18149
My game has several .plist and other .xml files. These are used to configure the behaviour of the game.
As far as I am concerned, any user can use iFunBox to gain access to the files - even if the device is not jailbroken, and easily modify their contents.
I'd like to avoid that. Is there a reasonable way to protect sensitive configuration files in my project?
A somewhat similar question is protecting plist in ipad app, although it is about protecting passwords in the keychain. However, my configuration files are several and, some of them, fairly large - so I'm not sure if that's quite viable.
Upvotes: 1
Views: 1302
Reputation: 4591
WARNING: There are some classes working with NSURL in iOS, they don't use NSURLProtocol
so we can NOT use this way for them. (e.g: -[NSData dataWithContentsOfURL:]
,...)
Original post
You can search with keyword "encrypt resources xcode".
I think the solution for you is ENCRYPTING RESOURCES
Very easy to do it, add new build phase:
DIRNAME=EncryptedResources
ENC_KEY="abcdefghijklmnopqrstuvwxyz123456"
INDIR=$PROJECT_DIR/$DIRNAME
OUTDIR=$TARGET_BUILD_DIR/$CONTENTS_FOLDER_PATH/$DIRNAME
if [ ! -d "$OUTDIR" ]; then
mkdir -p "$OUTDIR"
fi
for file in "$INDIR"/*
do
echo "Encrypting $file"
"$PROJECT_DIR/crypt" -e -k $ENC_KEY -i "$file" -o "$OUTDIR/`basename "$file"`"
done
This is a post about it: http://aptogo.co.uk/2010/07/protecting-resources/
See more at: Xcode: hide / protect resource files in final iOS app?
Upvotes: 4
Reputation: 26395
You could turn your .plist files into binary plists. That would at least make them not viewable in a text editor.
Beyond that, I'm not aware of any Apple-supplied method of encoding or protecting such files. However, you could use some sort of encryption in your .xml files (or text .plist files). You could simply run each string (property or attribute) or the entire file through an encryption algorithm during the build process and then decrypt it when you read it in.
Upvotes: 0