2
$\begingroup$

I am working on a concept for a game that in the end will allow data sharing via plain text, but I would like to give the user the option of encrypting the data so that other players cannot modify it, but the program/game will still be able to read the data for use otherwise. My question then would be, is there a method of encryption where the game/program has a master key that can decrypt the data, but also the user can input their own password as a key to modify the data? Thank you for your time.

$\endgroup$
  • $\begingroup$ Yes. $\:$ Do other players need to be able to verify a user's changes on their own? $\:$ Should the game/program not know the passwords? $\;\;\;\;$ $\endgroup$ – user991 Aug 18 '14 at 3:58
  • $\begingroup$ The situation isn't quite clear. If it is client/sever case with somewhat trustable middle boxes you don't even need the cryptography. If you mean an offline game in a gaming device if the game can manipulate the data the user will be able to do it as well no matter which method you use. If it is the latter case you can only obtain security through obscurity at best but if you mean the scheme that allow one to decrypt the data but not encrypt other data to the same format you probably looking for digital signature scheme. $\endgroup$ – Curious Sam Aug 18 '14 at 11:36
  • $\begingroup$ Thanks both for your replies. I'm really not after something super secure to be honest. I may not even bother with encrypting the data should it prove to be overkill for the project. I should probably go into a touch more detail of what I'm looking for. @Ricky Demer: I definitely don't want to go through the trouble of setting up any sort of central database for passwords. Ideally, the program/game would not know the user passwords/keys. $\endgroup$ – stainedofmind Aug 18 '14 at 15:35
1
$\begingroup$

I'll show a scheme with the following presumption:

  • the game has its own server key, this key is hidden in the game data somewhere (this usually cannot be secured completely, the game has to store the key somewhere);

So what you can do is to encrypt your game data with a randomly generated data key. If you use GCM mode of operation then you can verify if the data was tampered as well during decryption. This data key itself you encrypt (wrap) with the game key and the user key.

Now the game can always access and change the data. But the user needs to supply the user key. However, the user only has a password, so we need to convert that password to a user key. The way to do that is to use a Password Based Key Derivation Function such as PBKDF2, and use the output as the user key (note that you need to supply the PBKDF2 with a random salt that you generated & stored when the user account is created).


enter image description here


In the end you can make it as easy or hard as you want. One very interesting feature would be to let the user sign the game data as well; in that case the game can reject tampered game data.

It may also be a good idea to encrypt game data values separately, you can use a hash of the identifier of the specific data as Initialization Vector for the encryption/decryption.

$\endgroup$
  • $\begingroup$ Sorry, data flow/sequence diagrams were not enabled in the web based software :) $\endgroup$ – Maarten Bodewes Aug 19 '14 at 21:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.