Mathilde411 / bperipherals

https://www.curseforge.com/minecraft/mc-mods/bperipherals
Other
7 stars 5 forks source link

Add Diffie–Hellman key exchange function [FEATURE] #12

Closed ComputerErika closed 2 years ago

ComputerErika commented 2 years ago

So there's already a function to generate RSA Keys, and a function to encrypt/decrypt with AES, so if you exchange two public RSA keys, you could use the Diffie–Hellman key exchange method to both generate a secrete key to use with the AES, without ever exchanging the key, and I really want to do this, and I've been researching how to implement RSA DHKE in lua but Im totally stuck So it would be nice if it was included in the mod itself as a function :3

Im sure as the developer of a computer cryptographic mod you already knew about the DHKE but just in case it does this: ecdh(a.priv, b.pub) == ecdh(b.priv, a.pub) That way both parties can result in the same shared key over a network, without actually sharing anyway to get the key to other people Then use the key with AES Encryption and boom you're sharing secure encrypted messages without having to secretly send the other person anything

Also, I second the use the cryptographic accelerator on pocket computers/phones, that would be amazing, secure texting :D

Lastly, thanks for developing this so I don't go crazy trying to figure how to implement all these functions in pure lua xD

ComputerErika commented 2 years ago

Nevermind I'm an idiot

RSA Keygen doesn't work with Diffie–Hellman key exchange The reason I assumed it did was that in OpenComputer (The 1.12 Computer mod I came from) the Keygen function doesn't specify that it's not RSA, but actually EC, and because of my limited experience in cryptography, I assumed it was RSA.

I forked the 1.16.5 version of this mod and tried adding a Diffie–Hellman key exchange function myself, spent all morning on it, and from what I can tell the only way to have the DHKE is to have another keygen. So eh nevermind