Public-Key Cryptography

Symmetric encryption has a chicken-and-egg problem: to share a secret key securely, you seem to need a secure channel — which is what you were trying to build. Public-key cryptography is the astonishing idea that broke that loop: two mathematically-linked keys where knowing the public one doesn't reveal the private one. It's the foundation of key exchange, digital signatures, and essentially all secure communication over the open internet.

Symmetric encryption and MACs both assume the parties already share a secret key — but establishing that key over an insecure network is the hard part. Public-key (asymmetric) cryptography solves it with a key pair: a public key anyone can know and a private key kept secret. This post covers what asymmetric crypto is, the main flavors (RSA, elliptic curve), key exchange (Diffie-Hellman), and how it combines with symmetric crypto in the hybrid model that real systems use.

Two keys instead of one

Asymmetric cryptography uses a mathematically-linked key pair:

The magic is the asymmetry: what one key does, only the other can undo, and knowing the public key doesn’t let you derive the private key (it rests on math problems that are easy one way, infeasible to reverse). This enables two distinct capabilities depending on which key you use:

This two-key structure is what breaks symmetric crypto’s key-distribution deadlock: parties can establish trust and secrecy without a pre-shared secret, using freely-publishable public keys. It’s one of the most consequential ideas in computing — essentially all internet security depends on it.

RSA and elliptic curves

Two families of asymmetric crypto dominate, both public standards you use via libraries:

You don’t need to implement or deeply understand the math — you need to know that both are vetted standards, ECC is generally preferred today for efficiency, and key size matters (small RSA keys are broken; use recommended sizes). And critically, note what asymmetric crypto is not good for: it’s slow and suited only to small amounts of data. You never encrypt a large file directly with RSA/ECC — which is exactly why the hybrid model exists.

Key exchange: agreeing on a secret in the open

One of asymmetric crypto’s most important uses isn’t encrypting data directly — it’s key exchange: two parties agreeing on a shared symmetric key over an insecure channel, without an eavesdropper learning it. Diffie-Hellman is the foundational algorithm:

Diffie-Hellman (today, elliptic-curve ECDHE) is how essentially every TLS connection agrees on its encryption key. It’s the bridge between “we’ve never shared a secret” and “now we have a shared symmetric key” — the exact gap symmetric crypto couldn’t cross alone.

The hybrid model: best of both

Asymmetric and symmetric crypto have complementary strengths, so real systems combine them — the hybrid model underlying TLS and most secure systems:

Hybrid handshake (simplified):
   1. ECDHE key exchange  → both derive a shared symmetric key   (asymmetric, once)
   2. signature/certificate → verify the server's identity        (asymmetric, once)
   3. AES-GCM with that key → encrypt all the traffic             (symmetric, bulk)

This division of labor is why the hybrid model wins: asymmetric crypto does what only it can (key establishment and identity without pre-shared secrets) but is slow and small-data-only, so it’s used sparingly; symmetric crypto is fast and handles bulk, so it does the actual encryption once a key is established. Understanding this split demystifies TLS: the expensive public-key work happens once in the handshake, then cheap symmetric encryption carries the conversation.

What public-key crypto gives the engineer

Practically, asymmetric cryptography is what makes open-internet security possible, and as an engineer you rely on it constantly:

Public-key cryptography is the idea that broke the key-distribution deadlock: two linked keys enabling key exchange (Diffie-Hellman → a shared symmetric key with forward secrecy) and signatures (identity and non-repudiation), combined with fast symmetric crypto in the hybrid model. Next: digital signatures and PKI — how public keys become verifiable identities through certificates and chains of trust.

Key takeaways

Further reading

Sources & References

Establishing a shared key over an open channel