Diffie-Hellman (D-H) key exchange is a cryptographic protocol which allows two parties that have no prior knowledge of each other to jointly establish a shared secret key over an insecure communications channel. This key can then be used to encrypt subsequent communications using a symmetric key cipher.
Synonyms of Diffie-Hellman key exchange include:
The scheme was first published publicly by Whitfield Diffie and Martin Hellman in 1976, although it later emerged that it had been discovered a few years earlier within GCHQ, the British signals intelligence agency, by Malcolm J. Williamson but was kept classified. In 2002, Hellman suggested the algorithm be called Diffie-Hellman-Merkle key exchange in recognition of Ralph Merkle's contribution to the invention of public-key cryptography (Hellman, 2002).
Although Diffie-Hellman key agreement itself is an anonymous (non-authenticated) key agreement protocol, it provides the basis for a variety of authenticated protocols, and is used to provide perfect forward secrecy in TLS's ephemeral modes.
The method was followed shortly afterwards by RSA, another implementation of public key cryptography using asymmetric algorithms.
In 2002, Martin Hellman wrote:
, now expired, describes the algorithm and credits Hellman, Diffie, and Merkle as inventors.
The simplest, and original, implementation of the protocol uses the multiplicative group of integers modulo p, where p is prime and g is primitive mod p. Modulo (or mod) means that the integers between 0 and p − 1 are used with normal addition, subtraction, multiplication, and exponentiation, except that after each operation the result keeps only the remainder after dividing by p. Here is an example of the protocol:
| Alice | ||
| Sec | Calc | |
| p, g | ||
| a | ||
| ga mod p | ||
| … | ||
| (gb mod p)a mod p |
| = |
| Bob | ||
| Calc | Sec | |
| p, g | ||
| b | ||
| … | ||
| gb mod p | ||
| (ga mod p)b mod p |
Here's a more general description of the protocol:
Both Alice and Bob are now in possession of the group element gab which can serve as the shared secret key. The values of (gb)a and (ga)b are the same because groups are power associative. (See also exponentiation.)
Here is a chart to help simplify who knows what. (Eve is an eavesdropper - she watches what is sent between Alice and Bob, but she does not alter the contents of their communications.)
Let s = shared secret key. s = 2
let a = Alice's private key. a = 6
let b = Bob's private key. b = 15
let g = public base. g=5
let p = public (prime) number. p = 23
| Alice | |
| knows | doesn't know |
| p = 23 | b = 15 |
| base g = 5 | |
| a = 6 | |
| 56 mod 23 = 8 | |
| 5b mod 23 = 19 | |
| 196 mod 23 = 2 | |
| 8b mod 23 = 2 | |
| 196 mod 23 = 8b mod 23 | |
| s = 2 |
| Bob | |
| knows | doesn't know |
| p = 23 | a = 6 |
| base g = 5 | |
| b = 15 | |
| 515 mod 23 = 19 | |
| 5a mod 23 = 8 | |
| 815 mod 23 = 2 | |
| 19a mod 23 = 2 | |
| 815 mod 23 = 19a mod 23 | |
| s = 2 |
| Eve | |
| knows | doesn't know |
| p = 23 | a = 6 |
| base g = 5 | b = 15 |
| s = 2 | |
| 5a mod 23 = 8 | |
| 5b mod 23 = 19 | |
| 19a mod 23 = s | |
| 8b mod 23 = s | |
| 19a mod 23 = 8b mod 23 |
Note: It should be difficult for Alice to solve for Bob's private key or for Bob to solve for Alice's private key. If it isn't difficult for Alice to solve for Bob's private key (or vice versa), Eve may simply substitute her own private / public key pair, plug Bob's public key into her private key, produce a fake shared secret key, and solve for Bob's private key (and use that to solve for the shared secret key. Eve may attempt to choose a public / private key pair that will make it easy for her to solve for Bob's private key).
The order of G should be prime or have a large prime factor to prevent use of the Pohlig-Hellman algorithm to obtain a or b. For this reason, a Sophie Germain prime q is sometimes used to calculate p=2q+1, called a safe prime, since the order of G is then only divisible by 2 and q. g is then sometimes chosen to generate the order q subgroup of G, rather than G, so that the Legendre symbol of ga never reveals the low order bit of a.
If Alice and Bob use random number generators whose outputs are not completely random but can be predicted to some extent, then Eve's task is much easier.
The secret integers a and b are discarded at the end of the session. Therefore, Diffie-Hellman key exchange by itself trivially achieves perfect forward secrecy because no long-term private keying material exists to be disclosed.
A variety of cryptographic authentication solutions incorporate a Diffie-Hellman exchange. When Alice and Bob have a public key infrastructure they may digitally sign the agreed key, or ga and gb, as in MQV, STS and the IKE component of the IPsec protocol suite for securing Internet Protocol communications. When Alice and Bob share a password, they may use a password-authenticated key agreement form of Diffie-Hellman.
Cryptographic protocols | Asymmetric-key cryptosystems
Diffie-Hellman | Diffie-Hellman-Schlüsselaustausch | Diffie-Hellman | Échange de clés Diffie-Hellman | פרוטוקול דיפי-הלמן | Diffie-Hellman-sleuteluitwisselingsprotocol | Diffie-Hellman | Diffie-Hellman | Diffie-Hellman
This article is licensed under the GNU Free Documentation License.
It uses material from the
"Diffie-Hellman key exchange".
Home Page • arts • business • computers • games • health • hospitals • home • kids & teens • news • physicians • recreation• reference • regional • science • shopping • society • sports • world