What is Diffie-Hellman good for?

217 Views Asked by At

I understand the Diffie-Hellman process, but what I don't understand is: what can we do with the shared secret?

Say we're working $\bmod p$ with primitive root $r$. If Alice's private key is $\alpha$ and Bob's private key is $\beta$ then the shared secret will be $r^{\alpha \beta} \pmod p$. I can't see a way of making $r^{\alpha \beta} \pmod p$ be a number that either Alice or Bob chose beforehand, so they basically have a random number that no-one else knows.

But what good is that (effectively) random number $r^{\alpha \beta} \pmod p$?

What can they actually do with it?

2

There are 2 best solutions below

2
On BEST ANSWER

By generating a shared random number, they can then use that random number to generate a shared key with which they can apply a symmetric encryption algorithm (as opposed to a public-key one like RSA, which is asymmetric, because it involves one key for encoding and a different key for decoding).

Symmetric encryption algorithms generally are much faster than public-key algorithms like RSA. For any extended back-and-forth communication (as opposed to a one-off message), it's better to use a symmetric encryption algorithm. The problem with symmetric encryption algorithms is that you need to agree on a secret key using an insecure channel (if you had a secure channel, you wouldn't need encryption to begin with). That's the problem DH solves.

10
On

There are a few fundamental problems in cryptography. The problem that is most often discussed is "how easy is it to break the code". However, we can devise a scheme where, as long as the communicators can agree on a random "key", it is literally impossible to break the code. This scheme (at least, the simplest example of such a scheme) is known as a one-time pad.

With that in mind, the only challenge is to safely communicate this common, random key. That is, we need to solve the key-distribution problem. Traditionally, encryption requires one side to create the key and secretly deliver it to the other side; however, if the enemy intercepts the key, they can decrypt the message. The first thought one might have from there was to encrypt the key and then send it, but perhaps you can see how that brings us back to the same problem.

The Diffie-Helman key exchange (assuming it can't easily be reversed) solves the key-delivery problem by providing a way to generate and share a key in which an enemy can't simply decipher the code by intercepting a message.

So, what can we do with the shared secret? Generate a one-time pad, for one.


Another solution to the key-distribution problem is public key cryptography, which was also originally made by exploiting modular arithmetic and the difficulty of factorizing large numbers.