In Introduction to Symmetric Encryption for the Working Developer, we saw how to encrypt and decrypt data. Being symmetric encryption, both the process of encryption and decryption needed the same key. This poses a challenge, which was not addressed in the post: How do one get across the same key to both parties who want to engage in encrypted communication?
Basically how do we perform key exchange? How do we get the same key to parties who want to encrypt and decrypt messages?
An approach is perhaps for the parties involved to first meet in person and exchange the key?
Another approach could be to use another communication channel to first share the key? But then again, if the other communication channel is digital, and it uses symmetric encryption, how should its encryption key be also exchanged? This becomes a catch 22 real quick.
This is the problem Key exchange schemes seek to solve, and thankfully there is a secure way to have two parties exchange secret keys without the need to physically meet in person. This is what this post is about. We will be looking at two popular mechanisms for key exchange: Diffie-Hellman key exchange procedures and application of RSA for key exchange.
As always, as with the other posts in this series, the idea is to provide the basic information needed by the working developer to be able to understand and use these cryptographic primitives without going into the thick of their internal details or implementation.
This post contains the following sections
- Entering the realm of Public Key Cryptography
- Introduction to Diffie-Hellman Key Exchange: An Intuition.
- Whirlwind tour of the Mathematics
- Diffie-Hellman in code
- Diffie-Hellman Standards
- Using RSA for key exchange
- Conclusion and References