Compare symmetric and asymmetric (public-key) cryptography. What is the key-distribution problem, and how do protocols such as TLS combine the two? What is a digital signature?
Show the explanation
Symmetric encryption: the same secret key encrypts and decrypts.
- Examples: AES (commonly in GCM mode) and ChaCha20-Poly1305. Both are authenticated encryption, so they give integrity as well as confidentiality.
- Very fast, suitable for bulk data, and often hardware-accelerated.
- Problem: both sides need the key first. How do you share it safely over an untrusted network? And n people talking in pairs need about n²/2 keys.
Asymmetric (public-key) cryptography: each party has a key pair. The public key can be shared with anyone. The private key is kept secret.
- Encryption: anyone can encrypt with Bob's public key, and only Bob's private key decrypts it.
- Key agreement: Diffie–Hellman (ECDHE) lets two parties derive a shared secret over an open channel without ever sending it.
- Signatures: sign with the private key, verify with the public key.
- Examples: RSA and elliptic-curve schemes (ECDH, ECDSA, Ed25519).
- Much slower, and RSA can only encrypt a small amount of data per operation.
Using both (hybrid encryption). Public-key cryptography solves key distribution. Symmetric cryptography does the bulk work. In TLS 1.3, the client and server perform an ephemeral (EC)DHE key exchange to agree on fresh symmetric keys, the server proves its identity with a certificate and a signature, and all application data is then encrypted with AES-GCM or ChaCha20-Poly1305. Because the keys are ephemeral, stealing the server's long-term key later does not decrypt recorded past sessions. That property is called forward secrecy.
Digital signatures give authenticity, integrity and non-repudiation. The signer computes a hash of the message and signs it with the private key. Anyone with the public key can verify that the message is unchanged and came from the key's owner. Uses: TLS certificates, software updates, Git commit signing, e-signatures.
How do you trust a public key? Through certificates: a Certificate Authority signs a statement that "this public key belongs to example.com". Browsers trust a set of root CAs. That is the public key infrastructure (PKI).
Practical rule: use vetted protocols and libraries (TLS, libsodium, the platform's crypto APIs). Never design your own cryptography. The algorithms are rarely the weak point; implementations, modes and key management are.
Original UniCircle question. Last reviewed 22 Oct 2026.
