Quantum Key Distribution
Quantum key distribution (QKD) uses quantum mechanics to establish a shared secret key between two parties with information-theoretic security. Unlike classical cryptography, security is guaranteed by the laws of physics, not computational assumptions.
The key insight is that measuring a quantum state disturbs it β an eavesdropper introduces detectable errors.
BB84 Protocol
The BB84 protocol (Bennett & Brassard, 1984) uses two conjugate bases:
Alice's encoding:
- Bit 0: (Z-basis) or (X-basis)
- Bit 1: (Z-basis) or (X-basis)
Protocol steps:
- Alice sends qubits in random bases
- Bob measures in random bases
- They publicly compare bases (not results)
- Keep only matching-basis rounds -> sifted key
- Estimate error rate from public subset
- If error rate < threshold, perform error correction and privacy amplification
Security: If Eve intercepts, she introduces error rate >= 25% for random intercept-resend.
E91 Protocol
The E91 protocol (Ekert, 1991) uses entanglement and Bell's inequality for security:
- Source produces Bell pairs and sends one qubit to each party
- Alice and Bob measure in random bases
- Correlated measurements (same basis) form the raw key
- Uncorrelated measurements test Bell's inequality
Security is verified by violating the CHSH inequality:
Any eavesdropping reduces the violation below the quantum maximum .
Post-Quantum Cryptography
Post-quantum cryptography (PQC) refers to classical algorithms believed to be secure against quantum attacks. NIST has standardized several PQC algorithms:
| Algorithm | Type | Security Basis |
|---|---|---|
| ML-KEM (CRYSTALS-Kyber) | Key encapsulation | Module LWE |
| ML-DSA (CRYSTALS-Dilithium) | Digital signature | Module LWE |
| SLH-DSA (SPHINCS+) | Digital signature | Hash functions |
| FN-DSA (FALCON) | Digital signature | NTRU lattices |
These rely on the hardness of lattice problems, hash functions, or coding theory.
Quantum Random Number Generation
QRNG produces certifiably random numbers using quantum measurement:
where is the minimum entropy of the quantum source.
Vacuum fluctuation QRNG: measure vacuum noise with homodyne detection Device-independent QRNG: certify randomness from Bell violations
QRNGs are commercially available and used in QKD systems for key generation.
Quantum-Safe Migration
Organizations must prepare for the quantum threat:
- Inventory: catalog all cryptographic assets
- Assess: determine quantum vulnerability
- Prioritize: critical data with long sensitivity lifetime
- Migrate: transition to PQC algorithms
- Hybrid: use both classical and PQC during transition
The harvest now, decrypt later threat means encrypted data intercepted today may be decrypted by future quantum computers.
Python: BB84 Simulation
import numpy as np
def bb84_simulation(n=100, eve=False):
# Simulate BB84 QKD protocol.
np.random.seed(42)
alice_bits = np.random.randint(0, 2, n)
alice_bases = np.random.randint(0, 2, n)
bob_bases = np.random.randint(0, 2, n)
if eve:
eve_bases = np.random.randint(0, 2, n)
for i in range(n):
if eve_bases[i] != alice_bases[i]:
alice_bits[i] = np.random.randint(0, 2)
bob_bits = np.zeros(n, dtype=int)
for i in range(n):
if bob_bases[i] == alice_bases[i]:
bob_bits[i] = alice_bits[i]
else:
bob_bits[i] = np.random.randint(0, 2)
sifted = alice_bases == bob_bases
alice_key = alice_bits[sifted]
bob_key = bob_bits[sifted]
errors = np.sum(alice_key != bob_key) / len(alice_key)
return errors, len(alice_key)
err_no_eve, key_len = bb84_simulation(n=1000, eve=False)
print(f"No Eve: error={err_no_eve:.3f}, key_len={key_len}")
err_eve, key_len = bb84_simulation(n=1000, eve=True)
print(f"With Eve: error={err_eve:.3f}, key_len={key_len}")
This simulates BB84 and shows how eavesdropping increases the error rate.