Attic › Computer science › Public-key cryptography

Internet connections use public-key cryptography only to set up a faster shared key

About Hybrid cryptosystem

Public-key cryptography has one major weakness: the complex mathematics behind its trapdoor functions make it very slow. Because encrypting a large file or a video stream with a public key takes too much computing power, everyday internet connections use a hybrid cryptosystem. This system uses public-key cryptography only at the start of a connection to share a fast, temporary symmetric key.

A hybrid cryptosystem combines the convenience of public keys with the speed of symmetric keys. Traditional symmetric-key algorithms do not use complex prime numbers or elliptic curves; instead, they shuffle and substitute bits of data in simple, fast steps. A modern computer can encrypt data thousands of times faster with a symmetric key than with a public key.

When you connect to a secure website using Transport Layer Security (the protocol that puts the lock icon in your web browser), your computer and the website's server use a hybrid system in four steps:

1. The server sends its public key to your browser, along with a certificate to prove its identity.

2. Your browser checks the certificate and uses public-key cryptography to agree on a brand-new, random symmetric key with the server. This temporary key is called a session key.

3. Both computers switch to a fast symmetric-key algorithm, using the session key to encrypt and decrypt all the web pages, passwords, and files you send back and forth.

4. When you close the connection, both computers delete the session key and never use it again.

In the simplest form of this setup, your browser makes the session key, locks it with the server's public key, and sends it to the server. Today, most connections instead use a method like the Diffie–Hellman key exchange. In this method, the browser and the server each make a temporary public-and-private key pair just for that single visit, and combine their keys mathematically to build the session key together.

Deleting these temporary keys after every visit gives the connection forward secrecy. If an attacker records all of your encrypted internet traffic today, and then steals the website's main private key a year from now, the attacker still cannot unlock the recorded traffic, because the temporary keys that built the session key no longer exist.

Email security programs like Pretty Good Privacy (PGP) work the same way. When you encrypt an email, the software locks the message text with a fast, one-time symmetric key, locks that symmetric key with the receiver's public key, and sends both together.

Fact-checked against Public-key cryptography on Wikipedia

Part of the Computer science syllabus: Cryptography and Computer Security

See it on the timeline of Computer science