Diffie Hellman Key Exchange Algorithm
Diffie Hellman Key Exchange Algorithm
Introduction
Step 2: The private and public colors are mixed on each side to form a newly acquired
color mixture.
Step 3: They then exchange the mixture among the users over an insecure
communication channel, even though it may be open for hackers to intercept.
Step 4: The private colors are then mixed with the received mixture to finally acquire the
actual secret color (key).
As we notice, despite the critical exchange taking place over a channel with hackers
present, the malicious users received mixed colors, but not the secret key. Both users
can now encrypt their messages using the private key generated without fear of hackers
reading their conversations.
● DH uses the elliptic curve to generate points and get the secret key using the
parameters.
● For the sake of simplicity and practical implementation of the algorithm, we will
consider only 4 variables, one prime P and G (a primitive root of P) and two
private values a and b.
● P and G are both publicly available numbers. Users (say Alice and Bob) pick
private values a and b and they generate a key and exchange it publicly. The
opposite person receives the key and that generates a secret key, after which
they have the same secret key to encrypt.
Working
● The sender and receiver don’t need any prior knowledge of each other.
● Once the keys are exchanged, the communication of data can be done through
an insecure channel.
● The sharing of the secret key is safe.
● Diffie-Hellman offers perfect forward secrecy, meaning that even if a party's
private key is compromised, past communications remain secure because the
session keys are ephemeral and are not stored.
● It can be used with different encryption algorithms, allowing for flexibility in
choosing appropriate ciphers for specific applications.
● Diffie-Hellman eliminates the need for both parties to have pre-shared keys,
making it suitable for scenarios where keys cannot be exchanged in advance.
● Public parameters (prime number and primitive root modulo) can be reused,
reducing the computational overhead of key generation.
● The algorithm can not be used for any asymmetric key exchange.
● Similarly, it can not be used for signing digital signatures.
● Since it doesn’t authenticate any party in the transmission, the Diffie Hellman key
exchange is susceptible to a man-in-the-middle attack.
● Diffie-Hellman does not provide authentication by itself. Parties need to verify
each other's identities separately to prevent impersonation attacks.
● The computation of large exponents can be intensive, especially for devices with
limited computational resources. This can be mitigated by using efficient
algorithms and hardware acceleration.
● Diffie-Hellman only provides a method for key exchange. Managing and securing
the exchanged keys for further encryption (symmetric encryption) is the
responsibility of the communicating parties and requires additional protocols and
mechanisms.
● With the advent of quantum computers, algorithms like Shor's algorithm can
efficiently solve the discrete logarithm problem upon which Diffie-Hellman relies.
As a result, Diffie-Hellman is not quantum-resistant and requires post-quantum
cryptographic solutions for long-term security.
Difference between Diffie- Hellman Key Exchange and RSA:
1. Keys Type of Uses One Private Key Uses One Public and One
Algorithm Private Key.