Take the 2-minute tour ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

my question from stackoverflow: http://stackoverflow.com/questions/11374592/why-do-we-need-diffie-hellman

Diffie–Hellman offers secure key exchange only if sides are authenticated. for authentication, sides are using public/private key. so if side A knows the public key of the side B, then A can simply use that key to encrypt the message (or the new session key). why bother to use separate key exchange algorithm?

share|improve this question
    
related: crypto.stackexchange.com/questions/2271/… –  F21 Jul 7 '12 at 11:40
    
The article Ron was wrong, Whit is right might be of interest, too. –  j.p. Jul 15 '12 at 10:23
add comment

1 Answer 1

up vote 13 down vote accepted

I assume you're talking about SSL/TLS or a similar protocol. In these protocols there are two reasons to use Diffie-Hellman:

  1. Your certificate only supports signing
    Either it is an RSA certificate restricted to signing, or it uses an algorithm that doesn't support encryption, such as DSA or ECDSA.
  2. Forward security - What happens if the server's private key gets leaked somehow?
    If you simply encrypted the session key to the server's public key, all past communication with that server can be decrypted. Which is very bad.
    If an ephemeral Diffie-Hellman key-exchange was used, a private key leak won't compromize past communications, since the keys used for the key exchange are long gone, and the leaked long term key was only used for authentication and not for confidentiality.
  3. You don't know the public key of the other side
    There are situations where you don't know the other side's public key, but you have a different way to authenticate them. In that case you can use anonymous Diffie-Hellman together with that other way. For example TLS supports authentication based on a symmetric shared secret in a way that's secure against MitM.

Some other protocols such as CurveCP use EC Diffie-Hellman for both authentication and key-exchange. In this case they profit from the performance advantage elliptic curves have over RSA.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.