End-to-End Encryption: Diffie-Hellman

by Niels Triple

Version 3 (December 12, 2018)

Download (22 downloads)

Premium flow. No root required.

For a long time now, I wanted to write a Messenger flow in which users can send messages with End-to-End encryption, using uniquely in flow generated, unbreakable keys.

I did my homework, and took on the quest to figure out how the (to me insane) math behind a Diffie Hellman keyexchange works. I ultimately didn't go through with it, because (after I FINALLY figured out how the math worked) sadly Automate couldn't handle the calculations.

Long story short (less long):
In order to guarantee encryption I wanted to do a Diffie-Hellman key exchange, for which we need to do calculations with numbers over 2048 digits in order to create a safe encryption key.

Apparently Automate defines any number that has more than 300-something digits as "infinity", and sometimes big numbers get morphed into the scientific notation for no reason, so I ended up using 2 digit prime numbers (2 digits primes for the Diffie-Hellman flow, 1 digit primes for the RSA flow) to keep the calculations below infinity and/or "too big for regular notation" (it drove me mad to figure out why it kept on happening, but I can now say I have counted to infinity dozens of times, and it still SOMETIMES give an error).

2 digit numbers are a loooooong way from the desired 2048 digit numbers I need to create the keys I want (1024 digit numbers create encryptionkeys that can be cracked by someone with NSA-like capabilities), so I stopped with the Messenger part of the flow but kept the Diffie-Hellman part, and converted it into this flow (with atomic variables acting the role of messages between Alice and Bob) to help you understand how encryption works.

More info here:

My RSA Encryption flow:

The flow is fully functional and all calculations are random, like the real deal. This CAN be used (to create an encryption key) in Messenging flows, but it's just not secure enough to actually be trustworthy due too the small digit numbers.

5.0 average rating from 4 reviews

5 stars
4 stars
3 stars
2 stars
1 star

Reviews and ratings can be submitted in the app.