Sending encrypted data to a server

Monkey Forums/Monkey Programming/Sending encrypted data to a server

Raz(Posted 2013) [#1]
I would like to be able to send replay/best time data to a server. I would like to make it relatively difficult for someone to manipulate this data before submission. I assume the way to go with this is a public / private key encryption style system. I will decrpyt the data on a webserver that knows the private key. I intend on using PHP on the web server, so obviously it will need to be able to implement whatever system is used.

Is it reletively simple to implement? (see pseudo code below)

I am primarily targetting GLFW, but I figure it's worth discussing for all relevant targets.

I know New Start Soccer 5 was created with BlitzMAX, but I am assuming it implemtents something similar to what I am after (seeing as it has a leaderboard). I've not actually looked at the data it submits though, so I've no idea if it does actually encrypt anything.

Const PUBLIC_KEY:String = "WOOP"

Function EncrpytString:String(input:String)
	Return SomeCleverFunction(input,PUBLIC_KEY)
End

Local testString:String = EncryptString("This is to be encrypted")

PostDataToGameServer(testString)


and on the webserver

<?php

define("PRIVATE_KEY","WHATWHATWHAT");

$input = DecryptString($_POST['submitted_string'],PRIVATE_KEY);
ProcessInput($input);

?>