Jump to content
  • Advertisement
Sign in to follow this  
game game

Using the Shared Preferences and Its impact on the multi-stage games security

This topic is 1225 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When I read about Shared Preferences in internet I understand that the data stores in a xml file and using the emulator we can access to the xml file and this is bad for applications security.

In the world of android applications, there are games that they have many levels. If a player can go until Twenty level, when the player want to close the game and then when the player want to launch the game, the player should do the game from the same level.

I searched about this issue in internet and I understood that I should use from the Shared Preferences. But the problem is if in Shared Preferences data stores in a xml file and they are visible by emulator, as the result the game levels are permeable easily.

Are there alternative solutions? How can I create multi-stage games?

 

Share this post


Link to post
Share on other sites
Advertisement

Is it a single or multiplayer game?  If it is a single player game then what does it matter if they jump to the last level?  They aren't hurting anybody but themselves by missing out on content.  If it is an online game progress should be stored on the server.  Besides, while editing shared preferences isn't very hard it is more effort then your casual user probably wants to put in to it.

Share this post


Link to post
Share on other sites
The simple solution is to encrypt the data before writing it to the shared preferences.
Users cannot tamper with it unless they have the encryption key.
You can check integrity (and get the contents back) by decrypting.

If you also want to prevent users copying data values from others, you need something to indicate the user, the machine, or the installed program copy, as part of the data that you encrypt, so you can check that after loading.

Another option is to change the encryption keys for different installs. At least the latter will break uninstall + re-install of the application, as the new install will have a different key, and cannot decrypt the old data.

Share this post


Link to post
Share on other sites


I understand that the data stores in a xml file and using the emulator we can access to the xml file and this is bad for applications security.

Yes, it can be. So don't store security information -- like passwords -- in there.


when the player want to close the game and then when the player want to launch the game, the player should do the game from the same level.

That is game save data. It is not security information. Store it wherever you like.


But the problem is if in Shared Preferences data stores in a xml file and they are visible by emulator, as the result the game levels are permeable easily.
That is not a problem. Running in the emulator they can do anything they want. They can pause the program, debug it, look for values to cheat with, modify routines, and otherwise do whatever they want with the program.

 

That is not a thing you can change. You don't own their machine.


Are there alternative solutions? How can I create multi-stage games?
You build your games and store the data somewhere.  

 

You stop freaking out that other people can make changes or see ahead or otherwise poke and prod at your system.

 

If you are making an online game, you do things slightly differently. You build a protocol of commands and events that represent what goes across the network. Then you tightly control access to that critical data, giving only the information they need to render the game. The other content is kept on the server, never to leave the hardware you control.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!