https://medium.com/swlh/understanding-ec-diffie-hellman-9c0…

metamitya ·

https://medium.com/swlh/understanding-ec-diffie-hellman-9c07be338d4a

Replies

metamitya ·

Understanding EC Diffie-Hellman
If you’ve worked with web servers, the chances are that you’ve come across the Elliptic-curve Diffie–Hellman (ECDH) or Elliptic-curve Diffie–Hellman Ephemeral (ECDHE) cipher suites. You might have wondered what these suites implement and how they work. That is what we will discuss today.
To understand ECDH, we first have to dive into the standard Diffie-Hellman key exchange protocol. It was one of the first public-key protocols to be designed, back in 1976, and is still widely used today. It was named after Whitfield Diffie and Martin Hellman — both outstanding cryptographers that left their mark on the community, they were both part of the three-person team that invented public-key cryptography.
Traditionally, when one implemented encryption (symmetrical encryption), you would need to exchange a secret via a secure channel (could be of any form of transmission) — between two parties. The inherent flaw with this methodology is that a party can intercept the secret if they are privy to the communication channel. This secret can then be used to decrypt the encrypted data between the two parties, rendering it useless.
Cryptographic Keys
In cryptography, a key is a string of characters used within an encryption algorithm for altering data so that it appears random. Like a physical key, it locks (encrypts) data so that only someone with the right key can unlock (decrypt) it. It is important to note that every time you use the same key on the same data the result will be the same.
A key usually conforms to a certain size in bits. The use with symmetric encryption such as AES 256 the key sizes vary from 128 to 256 bits. In DH the key size is recommended to be upwards of 2000 bits where the same level of security can be achieved in ECDH with 250 bits. One can have a look at the Keylength website to get a better understanding of which key size is relevant to their implementation.
Diffie-Hellman
Diffie-Hellman allows the two parties, mentioned…