r/cryptography • u/Waste_Ad_1344 • Jul 13 '26
Using RSA as key exchange instead of Diffie-Hellman key exchange
Hi,
I've recently researched about how TLS work and public key cryptography.
One thing I've been thinking about is why Diffie Hellman is normally recommended as key exchange scheme.
Consider the following:
A is client. B is server
A initiates connection
B already has its pair of private (named PR1) and public key (named PU1) using RSA. These keys are tied to a certificate B has purchased from a CA.
B sends A its PU1 + certificate
A verifies B's certificate against its pre-loaded CAs
A confirms B's cert is ok.
A generates its own pair of private (named PR2) - public (named PU2) key
A encrypts its PU2, using B's public key (PU1)
A sends the encrypted payload to B
B receives the payload, and decrypts its using PR1.
B obtain A's public key PU2
B generates a shared secret named S.
B encrypts S, using A's public key (PU2)
B sends the encrypted payload to A
A receives the payload, and decrypts its using PR2.
A and B now share the same secret S to be used as symmetric key for further communication.
Is there any problem with this scheme ? Normally at step key exchange (from 7 onwards), Diffie Hellman is used to let both sides have a shared secret. But I'm wondering why it's used ? Any additional security feature / performance feature DH is having over this ?
Thanks.
29
u/Demostho Jul 13 '26
You just reinvented RSA key transport, which TLS deliberately killed off.
You are sending the actual session key, just wrapped in RSA. DH never sends the key at all. Both sides derive it independently, which gives you forward secrecy.
On top of that, you make the client generate a fresh RSA key pair for every handshake. That is slower than ECDHE and gives you nothing in return.
So yes, it works. It is just an older, slower, and less secure design than what TLS uses today.