简体   繁体   中英

Using keychain to store high scores and power ups

I'm wanting a more secure way to store high scores and power ups like stars/coins than using UserDefaults (which I believe can be altered by end user). I've seen the keychain mentioned as an alternative and after reading a little about it I get the impression it's main purpose is for storing passwords.

1, Is it ok to use the keychain for this purpose? 2, How much data can you realistically store? 3, Is it ok to write many changes to it very quickly, eg. Several times a second? 4, I believe there's many open source classes to deal with the keychain. Which is the best to use?

Thanks

Instead of storing highscores into a place where they don't belong, you might consider hashing them. If you read the highscore again, also compare the hash with a recalculated one. If they don't match, the highscore has been tampered with and you can blame the player for trying to cheat. The hashing algorithm can be something very sophisticated like SHA, or you can think of a simpler one yourself. I suppose it doesn't have to be too bullet proof for game scores.

Maybe this thread helps: How to secure NSUserDefaults?

They mention Secure-NSUserDefaults ctagory but I haven't used it yet. Though thanks for the question, that reminded me to use keychain in my apps too!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM