We prove the security of the Bennett-Brassard (BB84) quantum key distribution
protocol in the case where the source and detector are under the limited
control of an adversary. Our proof applies when both the source and the
detector have small basis-dependent flaws, as is typical in practical
implementations of the protocol. We derive a general lower bound on the
asymptotic key generation rate for weakly basis-dependent eavesdropping
attacks, and also estimate the rate in some special cases: sources that emit
weak coherent states with random phases, detectors with basis-dependent
efficiency, and misaligned sources and detectors.Comment: 22 pages. (v3): Minor changes. (v2): Extensively revised and
expanded. New results include a security proof for generic small flaws in the
source and the detecto