Quantum cryptography uses principles of quantum mechanics like quantum entanglement and the Heisenberg uncertainty principle to securely distribute encryption keys. It works by having Alice send individual photons encoded with bits to Bob, who measures them. They later communicate to discard any bits where their bases did not align. This prevents eavesdropping by Eve without introducing errors, allowing detection. After error correction and privacy amplification, the key can be used for encryption with perfect security. Quantum cryptography thus provides a secure way to transmit encryption keys.