This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
gknova61's profile picture

Regarding Crypto Key Exchange

Started by gknova61, 28 January 2014 - 11:21 PM
gknova61 #1
Posted 29 January 2014 - 12:21 AM
Hey guys, I just got a question on how 2 computers can securely exchange or agree on a symmetric key. Now, what I've got now is an RSA Public PreSharedKey for each of the 2 respective computers so they can communicate encrypted using RSA but given the performance and other issues of RSA, I'd rather just use RSA so the clients can communicate as little as possible to agree on an AES-256 Symmetric key to use. I've looked at the Diffie-Hellman key exchange but I've never really grasped it fully. If someone can help me implement that version of a key exchange in lua or explain how I can? Even explaining a different or better way to get 2 clients to agree on a symmetric key would be great :)/>
Edited on 28 January 2014 - 11:22 PM
Wojbie #2
Posted 29 January 2014 - 04:27 AM
You will have problem with Diffie-Hellman because calculations required for it to succeed use to big numbers for LUA to understand(300 digit prime)
I have unfinished version of this that went to trash because of such problem. I am working on workaround in free time (meta-tables rule!) but sadly no time estimate on this. Sorry for that :P/> Still good luck in future endeavors i am sure someone else can help :lol:/>
SquidDev #3
Posted 29 May 2014 - 05:18 PM
Sorry to bump but you can use KillaVanilla's Rednet Tunnling which uses AES and the Diffe-Hellman key exchange in the background.
Wojbie #4
Posted 29 May 2014 - 05:22 PM
True but sadly he uses small primes for that. While its secure sadly is not as "secure" as people want it to be secure :D/>
SquidDev #5
Posted 29 May 2014 - 06:41 PM
True but sadly he uses small primes for that. While its secure sadly is not as "secure" as people want it to be secure :D/>

Hmmm. Mixture of BigNumber (or BigInt) and AES-256 and I'm sure this could work. This might be an interesting side project for me to work on…
Edited on 29 May 2014 - 05:08 PM
Wojbie #6
Posted 29 May 2014 - 07:20 PM
Going by comments in his code he decided it was too much computation to utilize in useful manner - it slowed stuff to much. Have fun with that project if you decide to go with it. I had semi working prototype of Diffie-Hellman using BigInt but it was unstable. Never got around to finishing it.
SquidDev #7
Posted 30 May 2014 - 08:18 AM
Going by comments in his code he decided it was too much computation to utilize in useful manner - it slowed stuff to much. Have fun with that project if you decide to go with it. I had semi working prototype of Diffie-Hellman using BigInt but it was unstable. Never got around to finishing it.
The thing that will take the longest I guess is the primality test (and AES encryption/decryption). He uses Fermat's little theorem. I think things like the Sieve of Atkin is faster (as used here).