Do I need to store the score with a hash, ie to protect it from being edited/cheated by a user? From my newb knowledge, the user is unable to view and manipulate this locally stored data, as plist files for example. Can anyone elaborate?
[Edit] I'm storing scores locally and periodically uploading them to Game Center leaderboards. Even if the device is jailbroken I'd like to have security to prevent scores being manipulated by the user. What is a good approach?
I actually would do this:
Save it in an NSDictionary
and convert it to an NSData
object. Now comes the cool part:
Encrypt it into AES using this class:
https://web.archive.org/web/20160806074714/http://iphonedevelopment.blogspot.com/2009/02/strong-encryption-for-cocoa-cocoa-touch.html
This is a military standard encryption which will return an encrypted NSData
object. Then just save it to file and read/write whenever necessary. I've had really good experiences with this class and the user can't do anything to it.
Much better than just storing it in plain sight using NSUserDefaults
.
Give it a go!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With