Elliptic-curve Diffie–Hellman (ECDH) is a
key agreement
In cryptography, a key-agreement protocol is a protocol whereby two (or more) parties generate a cryptographic Key (cryptography), key as a function of information provided by each honest party so that no party can predetermine the resulting value ...
protocol that allows two parties, each having an
elliptic-curve public–private key pair, to establish a
shared secret
In cryptography, a shared secret is a piece of data, known only to the parties involved, in a secure communication. This usually refers to the key of a symmetric cryptosystem. The shared secret can be a PIN code, a password, a passphrase, a b ...
over an
insecure channel
In cryptography, a secure channel is a means of data transmission that is resistant to overhearing and tampering. A confidential channel is a means of data transmission that is resistant to overhearing, or eavesdropping (e.g., reading the conten ...
. This shared secret may be directly used as a key, or to
derive another key. The key, or the derived key, can then be used to encrypt subsequent communications using a
symmetric-key cipher
Symmetric-key algorithms are algorithms for cryptography that use the same cryptographic keys for both the encryption of plaintext and the decryption of ciphertext. The keys may be identical, or there may be a simple transformation to go between t ...
. It is a variant of the
Diffie–Hellman protocol using
elliptic-curve cryptography
Elliptic-curve cryptography (ECC) is an approach to public-key cryptography based on the algebraic structure of elliptic curves over finite fields. ECC allows smaller keys to provide equivalent security, compared to cryptosystems based on modula ...
.
Key establishment protocol
The following example illustrates how a shared key is established. Suppose
Alice
Alice may refer to:
* Alice (name), most often a feminine given name, but also used as a surname
Literature
* Alice (''Alice's Adventures in Wonderland''), a character in books by Lewis Carroll
* ''Alice'' series, children's and teen books by ...
wants to establish a shared key with
Bob
Bob, BOB, or B.O.B. may refer to:
People, fictional characters, and named animals
*Bob (given name), a list of people and fictional characters
* Bob (surname)
* Bob (dog), a dog that received the Dickin Medal for bravery in World War II
* Bob t ...
, but the only channel available for them may be eavesdropped by a third party. Initially, the
domain parameters (that is,
in the prime case or
in the binary case) must be agreed upon. Also, each party must have a key pair suitable for elliptic curve cryptography, consisting of a private key
(a randomly selected integer in the interval
, n-1
The comma is a punctuation mark that appears in several variants in different languages. Some typefaces render it as a small line, slightly curved or straight, but inclined from the vertical; others give it the appearance of a miniature fille ...
/math>) and a public key represented by a point
(where
, that is, the result of
adding to itself
times). Let Alice's key pair be
and Bob's key pair be
. Each party must know the other party's public key prior to execution of the protocol.
Alice computes point
. Bob computes point
. The shared secret is
(the ''x'' coordinate of the point). Most standardized protocols based on ECDH derive a symmetric key from
using some hash-based key derivation function.
The shared secret calculated by both parties is equal, because
.
The only information about her key that Alice initially exposes is her public key. So, no party except Alice can determine Alice's private key (Alice of course knows it by having selected it), unless that party can solve the elliptic curve
discrete logarithm
In mathematics, for given real numbers a and b, the logarithm \log_b(a) is a number x such that b^x=a. Analogously, in any group G, powers b^k can be defined for all integers k, and the discrete logarithm \log_b(a) is an integer k such that b^k=a ...
problem. Bob's private key is similarly secure. No party other than Alice or Bob can compute the shared secret, unless that party can solve the elliptic curve
Diffie–Hellman problem
The Diffie–Hellman problem (DHP) is a mathematical problem first proposed by Whitfield Diffie and Martin Hellman in the context of cryptography and serves as the theoretical basis of the Diffie–Hellman key exchange and its derivatives. The m ...
.
The public keys are either static (and trusted, say via a certificate) or ephemeral (also known as ECDHE, where final 'E' stands for "ephemeral").
Ephemeral keys
Ephemerality (from the Greek language, Greek word , meaning 'lasting only one day') is the concept of things being transitory, existing only briefly. Academically, the term ephemeral constitutionally describes a diverse assortment of things and ...
are temporary and not necessarily authenticated, so if authentication is desired, authenticity assurances must be obtained by other means. Authentication is necessary to avoid
man-in-the-middle attacks
In cryptography and computer security, a man-in-the-middle (MITM) attack, or on-path attack, is a cyberattack where the attacker secretly relays and possibly alters the communications between two parties who believe that they are directly communi ...
. If one of either Alice's or Bob's public keys is static, then man-in-the-middle attacks are thwarted. Static public keys provide neither
forward secrecy
In cryptography, forward secrecy (FS), also known as perfect forward secrecy (PFS), is a feature of specific key-agreement protocols that gives assurances that session keys will not be compromised even if long-term secrets used in the session ke ...
nor key-compromise impersonation resilience, among other advanced security properties. Holders of static private keys should validate the other public key, and should apply a secure
key derivation function
In cryptography, a key derivation function (KDF) is a cryptographic algorithm that derives one or more secret keys from a secret value such as a master key, a password, or a passphrase using a pseudorandom function (which typically uses a cr ...
to the raw Diffie–Hellman shared secret to avoid leaking information about the static private key. For schemes with other security properties, see
MQV.
If Alice maliciously chooses invalid curve points for her key and Bob does not validate that Alice's points are part of the selected group, she can collect enough residues of Bob's key to derive his private key. Several
TLS libraries were found to be vulnerable to this attack.
The shared secret is uniformly distributed on a subset of
of size
. For this reason, the secret should not be used directly as a symmetric key, but it can be used as entropy for a key derivation function.
Diffie-Hellman Key Agreement on Montgomery Curves
Let
such that
. The Montgomery form elliptic curve
is the set of all
satisfying the equation
along with the point at infinity denoted as
. This is called the affine form of the curve. The set of all
-rational points of
, denoted as
is the set of all
satisfying
along with
. Under a suitably defined addition operation,
is a group with
as the identity element. It is known that the order of this group is a multiple of 4. In fact, it is usually possible to obtain
and
such that the order of
is
for a prime
. For more extensive discussions of Montgomery curves and their arithmetic one may follow.
For computational efficiency, it is preferable to work with projective coordinates. The projective form of the Montgomery curve
is
. For a point
on
, the
-coordinate map
is the following:
[ if and if ]Curve25519
In cryptography, Curve25519 is an elliptic curve used in elliptic-curve cryptography (ECC) offering 128 bits of security (256-bit key size) and designed for use with the Elliptic-curve Diffie–Hellman (ECDH) key agreement scheme, first described a ...
which was introduced by Bernstein.[ For Curve25519, p = 2^ - 19, A = 486662 and B = 1.
The other Montgomery curve which is part of TLS 1.3 is ]Curve448
In cryptography, Curve448 or Curve448-Goldilocks is an elliptic curve potentially offering 224 bits of security and designed for use with the elliptic-curve Diffie–Hellman (ECDH) key agreement scheme.
History
Developed by Mike Hamburg of Rambus ...
which was introduced
by Hamburg. For Curve448, p = 2^ - 2^ - 1, A = 156326 and B = 1. Couple of Montgomery curves named M698
__NOTOC__
Year 698 ( DCXCVIII) was a common year starting on Tuesday of the Julian calendar. The denomination 698 for this year has been used since the early medieval period, when the Anno Domini calendar era became the prevalent method in Euro ...
and M058 58 may refer to:
* 58 (number)
* one of the years 58 BC, AD 58, 1958, 2058
* 58 (band), an American rock band
* 58 (golf), a round of 58 in golf
* "Fifty Eight", a song by Karma to Burn from the album ''Arch Stanton
''Arch Stanton'' is t ...
competitive to Curve25519
In cryptography, Curve25519 is an elliptic curve used in elliptic-curve cryptography (ECC) offering 128 bits of security (256-bit key size) and designed for use with the Elliptic-curve Diffie–Hellman (ECDH) key agreement scheme, first described a ...
and Curve448
In cryptography, Curve448 or Curve448-Goldilocks is an elliptic curve potentially offering 224 bits of security and designed for use with the elliptic-curve Diffie–Hellman (ECDH) key agreement scheme.
History
Developed by Mike Hamburg of Rambus ...
respectively have been proposed in.[, Code available at https://github.com/kn-cs/x25519] For M698
__NOTOC__
Year 698 ( DCXCVIII) was a common year starting on Tuesday of the Julian calendar. The denomination 698 for this year has been used since the early medieval period, when the Anno Domini calendar era became the prevalent method in Euro ...
p = 2^ - 9, A = 4698, B = 1 and for M058 58 may refer to:
* 58 (number)
* one of the years 58 BC, AD 58, 1958, 2058
* 58 (band), an American rock band
* 58 (golf), a round of 58 in golf
* "Fifty Eight", a song by Karma to Burn from the album ''Arch Stanton
''Arch Stanton'' is t ...
p = 2^ - 17, A = 4058, B = 1. At 256-bit security level, three Montgomery curves named M 96558 M 52902and M 504058have been proposed in. For M 96558 p = 2^ - 45, A = 996558, B = 1, for M 52902 p = 2^ - 75, A = 952902, B = 1 and for M 504058 p = 2^ - 1, A = 1504058, B = 1 respectively. Apart from these two, other proposals of Montgomery curves can be found at.
Software
* Curve25519
In cryptography, Curve25519 is an elliptic curve used in elliptic-curve cryptography (ECC) offering 128 bits of security (256-bit key size) and designed for use with the Elliptic-curve Diffie–Hellman (ECDH) key agreement scheme, first described a ...
is a popular set of elliptic curve parameters and reference implementation by Daniel J. Bernstein in C. Bindings and alternative implementations are also available.
* Curve448
In cryptography, Curve448 or Curve448-Goldilocks is an elliptic curve potentially offering 224 bits of security and designed for use with the elliptic-curve Diffie–Hellman (ECDH) key agreement scheme.
History
Developed by Mike Hamburg of Rambus ...
, an elliptic curve potentially offering 224 bits of security, developed by Mike Hamburg of Rambus
Rambus Inc. is an American technology company that designs, develops and licenses chip interface technologies and architectures that are used in digital electronics products. The company, founded in 1990, is well known for inventing RDRAM ...
Cryptography Research.
* LINE messenger app has used the ECDH protocol for its "Letter Sealing" end-to-end encryption
End-to-end encryption (E2EE) is a method of implementing a secure communication system where only communicating users can participate. No one else, including the system provider, telecom providers, Internet providers or malicious actors, can ...
of all messages sent through said app since October 2015.
* Signal Protocol
The Signal Protocol (formerly known as the TextSecure Protocol) is a non- federated cryptographic protocol that provides end-to-end encryption for voice and instant messaging conversations. The protocol was developed by Open Whisper Systems in ...
uses ECDH to obtain post-compromise security. Implementations of this protocol are found in Signal
A signal is both the process and the result of transmission of data over some media accomplished by embedding some variation. Signals are important in multiple subject fields including signal processing, information theory and biology.
In ...
, WhatsApp
WhatsApp (officially WhatsApp Messenger) is an American social media, instant messaging (IM), and voice-over-IP (VoIP) service owned by technology conglomerate Meta. It allows users to send text, voice messages and video messages, make vo ...
, Facebook Messenger
Messenger, formerly known as Facebook Messenger, is an American proprietary instant messaging service developed by Meta Platforms. Originally developed as Facebook Chat in 2008, the client application of Messenger is currently available o ...
and Skype
Skype () was a proprietary telecommunications application operated by Skype Technologies, a division of Microsoft, best known for IP-based videotelephony, videoconferencing and voice calls. It also had instant messaging, file transfer, ...
.
See also
* Elliptic-curve cryptography
Elliptic-curve cryptography (ECC) is an approach to public-key cryptography based on the algebraic structure of elliptic curves over finite fields. ECC allows smaller keys to provide equivalent security, compared to cryptosystems based on modula ...
* Diffie–Hellman key exchange
Diffie–Hellman (DH) key exchangeSynonyms of Diffie–Hellman key exchange include:
* Diffie–Hellman–Merkle key exchange
* Diffie–Hellman key agreement
* Diffie–Hellman key establishment
* Diffie–Hellman key negotiation
* Exponential ke ...
* Forward secrecy
In cryptography, forward secrecy (FS), also known as perfect forward secrecy (PFS), is a feature of specific key-agreement protocols that gives assurances that session keys will not be compromised even if long-term secrets used in the session ke ...
References
{{DEFAULTSORT:Elliptic curve Diffie-Hellman
Key-agreement protocols
Elliptic curve cryptography