Any plugin for this? JSON encrypt.

Discussion and feedback on Construct 2

Post » Wed May 16, 2018 12:43 pm

Hello, please, does anyone know if there is a plugin to encrypt JSON data ?.
I have used the search engine but I have not found anything.

My game will save information in JSON and I need to encrypt it so that the user can not alter it.
B
36
S
15
G
22
Posts: 956
Reputation: 15,222

Post » Wed May 16, 2018 3:59 pm

There were a post couple days ago by the dude who's making the bagel game (or something like this, Lou iirc). He asked about the same thing. The only way to do this is basically validate the data with a hash.
For example, you send 3 infos on the json: player_name, plays and score. By having another info, lets say, checksum, you can validate on server side if the 3 info matches the checksum.
For the checksum you can use kyatric's hash plugin and maybe use SALT+PLAYER_NAME+PLAYS+SCORE, having the salt being know both by the game and the server.
Actually, theres another way: to compute the score on server or basically simulating if the score is achievable.

This concern/problem is not a construct specific thing; the problem here is the ease for users to see/change the values.
B
19
S
7
G
4
Posts: 182
Reputation: 4,194

Post » Wed May 16, 2018 5:08 pm

Thanks for the info, although I expected a plugin to exist. Godot can encrypt the JSON data. Why can not C2 ?.
I do not understand very well the way you describe me because you talk about a server ?.
B
36
S
15
G
22
Posts: 956
Reputation: 15,222

Post » Wed May 16, 2018 5:15 pm

I thought u'd be using the json to save the data on a server.
Well, there are many things godot and other engines can do and construct don't but also the vice-versa.
But, afterall, i indeed don't understand why construct doesnt have a simple hash function.

Whats your scenario, exactly? What kind of data you want to store/encrypt? Do you need to "decrypt" it?
B
19
S
7
G
4
Posts: 182
Reputation: 4,194

Post » Wed May 16, 2018 5:21 pm

I'm doing a 1 vs 1 game with online and local mode.
The player wins rounds and unlocks levels and characters, that information should be saved on disk.

File that stores the following data:
Player's name
unlocked characters
unlocked levels
won rounds

So I think that I have to store this information locally, so I thought about using JSON.
But if I do not encrypt the data, the player could alter it and unlock everything.
B
36
S
15
G
22
Posts: 956
Reputation: 15,222

Post » Wed May 16, 2018 5:28 pm

I see, but why don't you store it on a server?
You could use gamesparks for example. They're even free (with limits, but really high).
Anyway, with the hash idea i gave to you, this is achievable:

player_name
characters_unlocked
levels_unlocked
rounds_won
hash

On your first layout (i suppose this is where you load the data into the dictionary/array youre using right?) you validate if a md5/sha1 hash of the 4 first infos (plus a SALT) matches the given (json) hash.
B
19
S
7
G
4
Posts: 182
Reputation: 4,194


Post » Wed May 16, 2018 5:39 pm



Ok thanks for this guys!
B
36
S
15
G
22
Posts: 956
Reputation: 15,222

Post » Wed May 16, 2018 5:44 pm

B
19
S
7
G
4
Posts: 182
Reputation: 4,194


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 29 guests