Questions tagged [diffie-hellman]

The Diffie–Hellman key agreement is an anonymous, non-authenticated key-agreement protocol.

Filter by
Sorted by
Tagged with
298 votes
11 answers
467k views

"Diffie-Hellman Key Exchange" in plain English

Can someone explain what the Diffie-Hellman Key Exchange algorithm in plain English? I have read that Twitter has implemented this technology which allows two parties to exchange encrypted messages on ...
user avatar
56 votes
2 answers
81k views

Decrypting TLS in Wireshark when using DHE_RSA ciphersuites

How can I decrypt TLS messages when an ephemeral Diffie-Hellman ciphersuite is used? I am able to expose the premaster secret and master secret from the SSL Client. Using that, how to decrypt the ...
Kalai's user avatar
  • 811
23 votes
2 answers
40k views

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

I opened a web page using HTTPS. When I looked at the page info provided by my Web browser (Firefox) I saw the following: Connection encrypted: High-grade Encryption (...
VL-80's user avatar
  • 1,234
85 votes
4 answers
56k views

What is Logjam and how do I prevent it?

I heard there is a "new" TLS vulnerability named Logjam, what does it do and how do I prevent it?
Arperum's user avatar
  • 941
132 votes
4 answers
117k views

Is there any particular reason to use Diffie-Hellman over RSA for key exchange?

I often see RSA being recommended as a method of key exchange. However, the Diffie-Hellman key exchange method appears to be secure as well. Is there any considerations one should take into account ...
user avatar
27 votes
3 answers
12k views

How does non-ephemeral Diffie-Hellman key exchange become compromised in SSL when the RSA private key is leaked?

From my understanding, one of the major reasons we recommend Diffie-Hellman Ephemeral (e.g. DHE or ECDHE) over non-ephemeral DH, for SSL / TLS, is that compromise of the RSA private key (i.e. private ...
Polynomial's user avatar
  • 135k
47 votes
2 answers
77k views

Diffie-Hellman and its TLS/SSL usage

I'm struggling to understand the (non-)use of Diffie-Hellman (DH) in TLS. DH has been around for a long time now, why does almost nobody use it, yet? DH is only being used for "key sharing", why does ...
David Halter's user avatar
32 votes
2 answers
33k views

Extract pre-master keys from an OpenSSL application

Consider an application using OpenSSL which has a bug. A packet capture of the full SSL session is available, as well as a core dump and debugging symbols for the application and libraries. A RSA ...
Lekensteyn's user avatar
  • 6,068
19 votes
1 answer
8k views

What's the hash for in ECDHE-RSA-AES-GCM-SHA?

Presumably the SHA is for deriving the AES key from the shared secret. Where else is the hash used? ECDH just does ECC (no hashing). RSA does masking and padding but this doesn't involve the ...
Nicholas Wilson's user avatar
75 votes
2 answers
100k views

Diffie Hellman parameters still calculating after 24 hours

I have a fresh install of Arch Linux on a RaspberryPi model B. I'm setting up OpenVPN and using easy-rsa with OpenSSL 1.0.2d to generate initial keys and certificates. All went fine until I ran ./...
kgizdov's user avatar
  • 873
37 votes
4 answers
31k views

Can someone explain what exactly is accomplished by generation of DH parameters?

I'm setting up a node.js server: https.createServer({ ... ciphers: 'ECDHE-RSA-AES128-SHA256:AES128-GCM-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH', honorCipherOrder: true }, app).listen(443); ...
Steven Lu's user avatar
  • 977
28 votes
1 answer
22k views

How does SSH use both RSA and Diffie-Hellman?

SSH protocol 2 allows you to use DSA, ECDSA, ED25519 and RSA keys when establishing a secure connection to a server. (Keep in mind for this question that I'm only familiar with the procedure and ...
IQAndreas's user avatar
  • 6,765
27 votes
2 answers
26k views

What is the difference between Diffie Hellman generator 2 and 5?

Generating Diffie Hellman parameters in OpenSSL can be done as follows: $ openssl dhparam -out dh2048.pem 2048 Generating DH parameters, 2048 bit long safe prime, generator 2 This is going to take a ...
gertvdijk's user avatar
  • 373
9 votes
2 answers
5k views

What are the implications of using the same DH parameters in a TLS server?

For a DHE cipher, nginx hard-codes the Diffie-Hellman parameters to use base 2 and a fixed 1024-bit prime (modulus) if no custom DH parameters are configured. These parameters are public (sent in ...
Lekensteyn's user avatar
  • 6,068
109 votes
6 answers
32k views

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

After reading the selected answer of "Diffie-Hellman Key Exchange" in plain English 5 times I can't, for the life of me, understand how it protects me from a MitM attack. Given the ...
orokusaki's user avatar
  • 1,352
15 votes
4 answers
13k views

What is the role of RSA in ECDHE-RSA? [duplicate]

I have read some textbooks and not found a convincing explanation. In the cipher suite ECDHE-RSA-AES128-GCM-SHA256, what is the role of RSA in the first part (ECDHE-RSA)? This part of the cipher ...
Johnny Willer's user avatar
3 votes
1 answer
10k views

Is Diffie–Hellman key exchange protocol vulnerable to man in the middle attack?

Diffie–Hellman key exchange protocol vulnerable to man in the middle attack? If yes, then what type of MITM is that? I believe that is a replay attack or a relay attack, not sure though.
Mohammad's user avatar
  • 527
1 vote
3 answers
3k views

Using a stolen certificate on a server

Yesterday I asked the following question regarding what would happen if you placed a stolen certificate on your own server and edited the 'host' file so that the DNS name matched: Could a stolen ...
RJSmith92's user avatar
  • 311
139 votes
3 answers
165k views

What's the purpose of DH Parameters?

For a Diffie–Hellman (D-H) key exchange (TLS) the server generates a prime p and a generator g, which is a primitive root modulo p. When setting up a webserver with SSL/TLS (e.g. nginx) one can use a ...
Ben Richard's user avatar
  • 3,496
34 votes
2 answers
15k views

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

There is a web site weakdh.org, whose name alone would certainly cause some feeling of uncertainty in using DH among people who are not experts IMHO. Could some knowledgeable person kindly say ...
Mok-Kong Shen's user avatar
30 votes
3 answers
38k views

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

In response to Logjam I want to prove I've hardened my services. I know that the DH param has to be 2048 bits at least and self generated. But I am unable to find a way to actually check this for ...
LvB's user avatar
  • 8,723
20 votes
2 answers
23k views

OpenVPN dhparam

One of the steps for setting up OpenVPN is running the command openssl dhparam -out dh1024.pem 1024. The man page tells me this 1024 value refers to the number of bits. Why is the value 1024 ...
Zoredache's user avatar
  • 653
15 votes
1 answer
13k views

What are the OpenSSL standard Diffie-Hellman parameters (primes)?

I recently generated some custom Diffie-Hellman parameters which are basically just long (in the below case 4096 bit) primes. Those are then used in the key exchange process. I used the following ...
binaryanomaly's user avatar
10 votes
2 answers
30k views

Is there a key length definition for DH or DHE?

I found this in wiki The Finite Field Diffie-Hellman algorithm has roughly the same key strength as RSA for the same key sizes. The work factor for breaking Diffie-Hellman is based on the discrete ...
Zack's user avatar
  • 101
10 votes
2 answers
8k views

In Ephemeral Diffie Hellman Key Exchange - what is actually ephemeral?

Just starting to learn about Diffie-Hellman, and it seems simple enough, but I am struggling to find any resources that explain in an Ephemeral Diffie Hellman Key Exchange, what it is that is actually ...
stats_novice_123's user avatar
8 votes
2 answers
9k views

Are Telegram secret chats secure assuming MTProto isn't?

For those who don't know: Telegram is a partially open source Whatsapp alternative (Server is closed source) which offers secret chats and normal chats. Secret chats are encrypted with Diffie-Hellman ...
Hello World's user avatar
6 votes
1 answer
9k views

How ECDHE is signed by RSA in ECDHE_RSA cipher

About ciphers that use ECDHE as Key Exchange and RSA as Authentication: How exactly this two algorithms work together, is ECDHE process encrypted by RSA public key? What are the DH parameters? ...
Johnny Willer's user avatar
3 votes
2 answers
2k views

For DHE_RSA_.. Cipher Suites what is RSA used for?

In addition to achieving PFS with DHE, we want as little as possible to be revealed when the server's private key is revealed. So, what is RSA used for in DHE_RSA cipher suites? What does the server ...
OregonTrail's user avatar
3 votes
1 answer
3k views

Setup Wireshark to decrypt TLS_DHE

I have a passively sniffed traffic dump of client/server were packets are encrypted with cipher suite Cipher Suite: TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 (0x009e) With a Logjam attack I managed to ...
Sirt's user avatar
  • 33
2 votes
2 answers
11k views

Understanding SSL man-in-the-middle and its limitations

I’m trying to develop a good sense of how an SSL man-in-the-middle(s) (MITM) works. As I understand it, MITMs do their work in one of two ways: Decrypt the SSL by having a copy of the server’s ...
The_Glidd's user avatar
49 votes
4 answers
8k views

Why is key exchange necessary at all?

Let's say "Alice" and "Bob" want to communicate with each other over an insecure network. Using Diffie–Hellman key exchange, they can get the same symmetric key at last. However, as I understand, ...
Firegun's user avatar
  • 503
23 votes
2 answers
4k views

Why is Mozilla recommending predefined DHE groups?

In a revision dated 2016-10-31, Mozilla changed their Server Side TLS recommendation from generating a random DH group to the ones published in RFC 7919. Mozilla claims: These groups are audited and ...
willwill's user avatar
  • 505
23 votes
2 answers
24k views

What is the difference between DH and DHE?

I have been reading Bulletproof SSL and TLS Diffie Hellman is a key exchange mechanism, in which each of server and client share secret i.e. gx and gy respectively with each other where g is ...
prakharjain's user avatar
18 votes
2 answers
20k views

DH parameters recommended size?

I'm setting up EAP-TLS on my wireless router, and am currently generating DH parameters for FreeRADIUS. First, what do these parameters do? Also, what size should they be? I've been generating the ...
Naftuli Kay's user avatar
  • 6,753
12 votes
1 answer
9k views

When exactly is Diffie-Hellman used in TLS?

I'm aware that Diffie-Hellman is a key exchange algorithm whereas RSA is an asymmetric encryption algorithm. I have the following questions: During TLS handshake, will both RSA and DH be used? (I ...
Vinod Pn's user avatar
  • 385
9 votes
1 answer
10k views

How does TLS work (RSA, Diffie-Hellman, PFS)?

I know "How TLS works" has been discussed numerous times here and crypto, but I am still somewhat confused and would like to summarize what I know so far 1 in this giant blob of text with ...
CppLearner's user avatar
9 votes
1 answer
16k views

Authenticated Diffie Hellman Key Exchange

It appears that the textbook version of Diffie-Hellman is susceptible to man in the middle attack and the use of digital signatures could prevent this attack from occurring. Digital signatures could ...
Computernerd's user avatar
  • 2,421
8 votes
1 answer
1k views

Do Diffie-Hellman parameters need to be recreated regularly?

Having generated 2048-bit DH params, do I need to regenerate them regularly? If so, how frequently should I do this?
Roger Lipscombe's user avatar
6 votes
1 answer
16k views

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

As the question already states, I'd like to know if the dh1024.pem file, generated by ./build-dh in openvpn, is dependent on the ca.(crt|key) file. The reason was that I needed to ./clear-all the ...
Daniel F's user avatar
  • 182
5 votes
2 answers
202 views

Where in a TLS connection can I get the signature of the content sent by the server?

I want to be able to prove that a given content returned by a HTTPS server was in fact served. I have looked over the whole TLS protocol and I found I can use ServerKeyExchange to get the server's ...
Luis Cuende's user avatar
5 votes
2 answers
2k views

Does changing /etc/ssh/moduli impact previously generated keys?

My company does a lot of automated file transfers over SSH/sftp with banks, etc. A recent SSH upgrade on a server dropped support for the old/weak diffie-hellman-group1-sha1 key exchange protocol in ...
sbrown's user avatar
  • 151
5 votes
3 answers
6k views

it is possible to decrypt HTTPS with the (private, public) pair if it uses DHE?

Assuming you have a PCAP file with HTTPS traffic and having the key pair (private & public), it is possible to decrypt the traffic if it uses Diffie Hellman Ephemeral? Using openSSL lib for ...
Carlos Vega's user avatar
5 votes
3 answers
8k views

Why is the reuse of the Elliptic curve Diffie–Hellman (ECDH) public server param considered bad?

When reviewing the SSL/TLS configuration using Qualys SSL Labs, I've found that the reuse of the Elliptic curve Diffie–Hellman (ECDH) public server param was flagged. Why is the reuse of the Elliptic ...
Bob Ortiz's user avatar
  • 6,661
4 votes
2 answers
4k views

How to verify Diffie Hellman uses a "Safe" prime

I'm the developer for a web application that was recently pen tested. One of the vulnerabilities reported from the pen test is that our server uses an unsafe Diffie-Hellman prime in our key exchange. ...
The Gilbert Arenas Dagger's user avatar
4 votes
1 answer
2k views

ECDH and static key encryption

It's been a while and I'm still trying to figure out if my understanding of ECC crypto is correct. Basically from what I understood a purely asymmetric encryption is never used. Usually the ...
frarugi87's user avatar
  • 143
3 votes
2 answers
2k views

Is server public key and Diffie Hellman public are the same?

I am trying to understand the working of TLS. I understand that there are various way to generate the master secret used to encrypting the data. Such as DH (Ephemeral DHE) and RSA. I understand that, ...
Anonymous Platypus's user avatar
3 votes
2 answers
2k views

RSA key exchange

I want to create a message exchange program. These messages are encrypted with the AES key, and this key is encrypted using the RSA algorithm. When I send a message from User 1 to User 2, I need to ...
HUS.97's user avatar
  • 41
2 votes
1 answer
3k views

OpenSSL Generate ECDH Public Key

I am trying to use the OpenSSL command line to generate a ECDH public key that meets the following specifications: Use a Base64 encoded X.509 SubjectPublicKeyInfo structure containing a ECDH public ...
PassKit's user avatar
  • 123
2 votes
3 answers
4k views

Understanding Diffie-Hellman key exchange

I understand the diagram up till the point where Bob and Alice do a "Public transport" of their respective mixture. I am wondering how do Bob and Alice know what secret colour to add ( circled picture ...
Computernerd's user avatar
  • 2,421
2 votes
1 answer
437 views

How often should the DHE p and g factors be recycled?

I've been asked to enable DHE in our SMTP product. I'm stuck on this question: How often should the product regenerate its DHE p and g parameters? I've seen some implementations that use a cron job ...
Carl S. Gutekunst's user avatar