Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Made a little crypto-package for safe(-ish) transport between frontend and backend.

Author
Message
Dybing
13
Years of Service
User Offline
Joined: 12th Sep 2011
Location: Bergen, Norway
Posted: 15th Apr 2017 20:05 Edited at: 15th Apr 2017 20:22
Being poised with a project that require transporting sensitive data from a backend (in Go) to a frontend (in AGK) and AppGameKit having no built in security/cryptography functionality I had to roll my own as it were. Before you ask, yes it do go through a SSL layer as defined by the cert on the backend - but even so, I felt uncomfortable having the traffic go from server to client without some extra protection.

Anyhow, on with the code:



The above is pretty much to just copy-paste into AppGameKit and good to go. Included a bit of print commands for showing the encrypted data and the same when decrypted. As for what to do on the server, you'll have to translate it to whatever language you prefer. Unless of course you run AppGameKit on the server as well for some odd reason. My encoding code in Go look like this:



As for how to generate and distribute the password, and assign one to each user and so forth - I am sure you can figure something out.

Using a 20 character key, with characters including 0..9, a..z and A..Z you get 6.200.000.000.000.000.000.000 possible combinations - assuming a hacker try and brute-force an intercepted package, at a billion guesses per minute it'll take just shy of 6 million years before having a 50% chance of hitting the right combination.

Login to post a reply

Server time is: 2024-11-24 16:59:14
Your offset time is: 2024-11-24 16:59:14