166 votes
Accepted

Why can't I MitM a Diffie-Hellman key exchange?

Diffie-Hellman is a key exchange protocol but does nothing about authentication. There is a high-level, conceptual way to see that. In the world of computer networks and cryptography, all you can see,...
  • 169k
132 votes
Accepted

Diffie Hellman parameters still calculating after 24 hours

If openssl uses a lot of CPU then it is not blocked waiting for "entropy". OpenSSL is actually sane in that respect, and uses a cryptographically secure PRNG to extend an initial seed into as many ...
  • 169k
108 votes
Accepted

What is Logjam and how do I prevent it?

TL;DR SSL/TLS client and server agree to use some weak crypto. Well, turns out that weak crypto is weak. In Detail When an SSL/TLS protocol is performed, the client sends a list of supported cipher ...
97 votes

What's the purpose of DH Parameters?

What exactly is the purpose of these DH Parameters? These parameters define how OpenSSL performs the Diffie-Hellman (DH) key-exchange. As you stated correctly they include a field prime p and a ...
  • 9,500
58 votes

Why can't I MitM a Diffie-Hellman key exchange?

Tom has provided a good explanation as to why Diffie-Hellman cannot be safe against man-in-the-middling. Now this answers the OP's original question but probably leaves some readers with the (...
  • 1,233
57 votes
Accepted

Why is key exchange necessary at all?

If the attacker is able to passively capture data and later gets access to the private key of the certificates (i.e. stealing, heartbleed attack or law enforcement), then the attacker could decode all ...
49 votes

What is the simplest safe way to convey a password to another person?

I too have tried to come up with a good solution for this. But I found https://onetimesecret.com/ which works great. Basically you create a link containing a password and you send this link to the ...
  • 666
39 votes

What is the current security status of Diffie-Hellman key exchange?

The weakdh.org Web site is about the Logjam attack. Contrary to what the Web site name may suggest to the unwary, this is not about DH being weak; it is more about doing things weakly when using DH. ...
38 votes

Relationship between RSA, Diffie-Hellman Key Exchange, PKI and X.509?

RSA is two algorithms, one for asymmetric encryption, the other one for digital signatures. They use the same kind of keys, they share the same core operation, and they are both called "RSA". Diffie-...
32 votes

Why not use symmetric encryption?

If you talk to 1000 persons and use pre-shared symmetric keys, then you have to remember 1000 secret keys. Secret key storage can be hard. With asymmetric encryption you just have to remember only ...
32 votes
Accepted

How does SSH use both RSA and Diffie-Hellman?

The host key is used to sign the Diffie-Hellman parameters. It is used during the key exchange; RSA is a signature algorithm as well as an encryption algorithm. From what I can tell, the client key (...
  • 7,223
30 votes
Accepted

Client-server encryption technique explanation (TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, 128 bit keys)

Asymmetric Cryptography There are two different parts to creating a TLS session. There is the asymmetric cryptography, portion which is an exchange of public keys between two points. Which is what ...
  • 12.3k
29 votes

What is Logjam and how do I prevent it?

Logjam shouldn't really be called a "new" vulnerability - it's a rehash of FREAK which targets export-grade DH rather than export-grade RSA. Practical exploitation relies on the following flaws: The ...
  • 132k
28 votes
Accepted

Extract pre-master keys from an OpenSSL application

Note: as of OpenSSL 1.1.1 (unreleased), it will be possible to set a callback function that receives the key log lines. See the SSL_CTX_set_keylog_callback(3) manual for details. This can be injected ...
  • 5,898
26 votes

"Diffie-Hellman Key Exchange" in plain English

The key exchange problem A secure connection requires the exchange of keys. But the keys themselves would need to be transfered on a secure connection. There are two possible solution: exchange the ...
  • 409
26 votes

Why not use symmetric encryption?

I think you're underestimating the value of contacting someone you've never talked to before, and you're overestimating the complexity of a public-key system. Any time you want to contact someone new ...
  • 5,780
22 votes
Accepted

How to check if a server is not vulnerable to Logjam?

Do the smoke test: (stolen from OpenSSL blog. (Archived here.)) openssl s_client -connect www.example.com:443 -cipher "EDH" | grep "Server Temp Key" The key should be at least 2048 bits to offer a ...
21 votes
Accepted

What is the difference between DH and DHE?

Diffie-Hellman is an asymmetric algorithm, with a public key and a private key. In a "DH_RSA" cipher suite, the server's "permanent" key pair is a DH key pair. The public key is in the server's ...
20 votes
Accepted

When exactly is Diffie-Hellman used in TLS?

DH is a key exchange algorithm, it is used to derive the session key that's later used in the symmetric encryption. DH by itself is not authenticated, so while you can derive the session key without a ...
  • 31.1k
20 votes
Accepted

RSA key exchange

TL;DR: Skip to "Using result of DH". Because you started with "I want to create a message exchange program" together with "I don’t know how to use DH", a tedious preface: ...
  • 7,778
19 votes
Accepted

Authenticated Diffie Hellman Key Exchange

Your description is a bit confused and appears to be wrong. In particular, we see Alice computing here Diffie-Hellman half gKA and then proceed to send... her Diffie-Hellman secret KA to Bob, which is ...
17 votes

Why is key exchange necessary at all?

There are many steps needed to understand the reasons and I will try to guide you through each. 1) Use encryption correctly... With RSA algorithm, Alice and Bob can just share their public keys (...
  • 6,921
17 votes
Accepted

Is 8192 Diffie-Hellman overkill?

Edit 2015-12-23Wed.: I'm not happy with this answer anymore. While I still think that 8k DHParams are misplaced effort and overkill (and you're better off with ECDH) the explanation that I gave was ...
13 votes

What is the current security status of Diffie-Hellman key exchange?

First of all, don't panic, Diffie-Hellman's algorithm is totally fine if used right (with right set of parameters). Let me explain some preliminaries: Whats SSL/TLS Protocol? It's the underlying ...
  • 3,369
13 votes
Accepted

Why is Mozilla recommending predefined DHE groups?

I think the reason for using predefined groups is clearly answered at the page your reference: Instead of using pre-configured DH groups, or generating their own with "openssl dhparam", ...
12 votes
Accepted

Why OpenVPN is using both certificates and DH?

Key pairs are used for two things: Encrypting a secret value for symmetric encryption Signing data for validation Both RSA and DH are based in asymmetric algorithms. So we have two cases for a ...
  • 12.3k
12 votes
Accepted

which diffie-hellman group is needed for secure ike/ipsec

Let's define a few things clearly... When you use an asymmetric algorithm like DH, it has a "strength" that relates to the difficulty of breaking through it with the best known attacks. The best ...
12 votes
Accepted

In OpenVPN, is the dh1024.pem file dependent on the CA?

That file has no dependency on any certificate or private key. It is not secret either. It can even be shared between various servers that don't necessarily trust or even know each other. The dh1024....
  • 169k
12 votes

Why not use symmetric encryption?

The problem that asymmetric encryption solves is that it retains control over who can and can't sign/encrypt messages. Suppose you have a symmetric key K. Alice, Bob, and Eve share this key K so that ...
11 votes

"Diffie-Hellman Key Exchange" in plain English

Securing data as it passes through the internet usually requires protecting it in two ways: Confidentiality -- assuring no one except the intended recipients can read the data Integrity -- assuring ...
  • 751

Only top scored, non community-wiki answers of a minimum length are eligible