Skip to content

Commit 8310584

Browse files
committed
Align Diffie-Hellman with current practice
I've updated the last part of DH to be more aligned with current practice. Static/fixed DH is actively discouraged in practice, so might as well not discuss it. Simpler solution to fix MitM for DH is to just add signatures. Corrected the explanation of "ephemeral" and (P)FS, since this does not rely on fixed DH parameters. Briefly mentioned Elliptic Curve in the context of DH, since ECDHE is the most widely used variant in practice.
1 parent 5aac679 commit 8310584

File tree

1 file changed

+25
-31
lines changed

1 file changed

+25
-31
lines changed

key-distro.rst

Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -486,41 +486,35 @@ instead of each other.
486486

487487
A man-in-the-middle attack.
488488

489-
A variant of Diffie-Hellman sometimes called *fixed Diffie-Hellman*
490-
supports authentication of one or both participants. It relies on
491-
certificates that are similar to public key certificates but instead
492-
certify the Diffie-Hellman public parameters of an entity. For example,
493-
such a certificate would state that Alice’s Diffie-Hellman parameters
494-
are *p, g*, and :math:`g^a \bmod p`
495-
(note that the value of *a* would still be known only to Alice). Such
496-
a certificate would assure Bob that the other participant in
497-
Diffie-Hellman is Alice—or else the other participant won’t be able to
498-
compute the secret key, because she won’t know *a*. If both participants
499-
have certificates for their Diffie-Hellman parameters, they can
489+
A simple solution for this is to add signatures to the messages containing
490+
Diffie-Hellman parameters. This relies on public keys that can be verified
491+
through other means, such as Certificate Authorities, or Web of Trust.
492+
If both participants have certificates, they can
500493
authenticate each other. If just one has a certificate, then just that
501494
one can be authenticated. This is useful in some situations; for
502495
example, when one participant is a web server and the other is an
503496
arbitrary client, the client can authenticate the web server and
504497
establish a secret key for confidentiality before sending a credit card
505498
number to the web server.
506499

507-
A further variant of Diffie-Hellman, which is used in TLS, is called
508-
*ephemeral* Diffie-Hellman. Like the fixed variant, it relies on at
509-
least one participant having a certificate issued by a CA, but in this
510-
case it certifies that Alice is associated with a given public key
511-
(e.g., an RSA key). Alice then generates an ephemeral value of *a*
512-
rather than a fixed one, and uses her private key to sign the Diffie
513-
Hellman parameters: *p, g*, and :math:`g^a \bmod p`. By providing the
514-
certificate and the signed value, Alice is able to show Bob that the
515-
message has really come from her and authenticate the Diffie-Hellman
516-
parameters, while still keeping *a* secret. Unlike fixed
517-
Diffie-Hellman, this approach provides *forward secrecy*, meaning that
518-
even if the long-lived private key of Alice were to be compromised,
519-
past sessions that had been recorded by an attacker will still be
520-
secure, since they used ephemeral keys that changed with every
521-
session. Note that while the word "ephemeral" strictly implies only
522-
that *a* is a short-lived value, it is widely used in protocol
523-
specifications to apply to cases where authentication is also
524-
performed using a public key as we have described it here. To avoid
525-
confusion, the original form of Diffie-Hellman that lacks
526-
authentication is often referred to as "anonymous" mode.
500+
501+
Diffie-Hellman key exchange is used in TLS since version 1.0, and is often
502+
used in the *ephemeral* variant (DHE). The ephemeral part of this is
503+
that the initial secret and the resulting common secret are only kept
504+
in memory during the session. After the session is completed, the
505+
secrets are not kept, but destroyed. This creates the property of
506+
*forward secrecy*, as the secret is only known during the session,
507+
and can not be recovered.
508+
509+
Remember that the secret values are not transmitted during the initial
510+
exchange of messages. This means that any recorded traffic can later
511+
not be decoded, because the key for decoding has been destroyed after
512+
the session, and can not be reconstructed.
513+
514+
Most modern implementations use a different variant of Diffie-Hellman
515+
based on elliptic curves. This is indicated using 'EC' as prefix, so
516+
it becomes 'ECDHE' (Elliptic Curve Diffie-Hellman Ephemeral).
517+
Explaining elliptic curve arithmetics goes beyond the scope of this
518+
book, but roughly works in the same way and also provides the same
519+
guarantees as before, but is more efficient and at least as hard
520+
to break computationally at the moment.

0 commit comments

Comments
 (0)