  The goal of quantum key distribution (QKD) is to establish a secure key
between two parties connected by an insecure quantum channel. To use a QKD
protocol in practice, one has to prove that a finite size key is secure against
general attacks: no matter the adversary's attack, they cannot gain useful
information about the key. A much simpler task is to prove security against
collective attacks, where the adversary is assumed to behave identically and
independently in each round. In this work, we provide a formal framework for
general QKD protocols and show that for any protocol that can be expressed in
this framework, security against general attacks reduces to security against
collective attacks, which in turn reduces to a numerical computation. Our proof
relies on a recently developed information-theoretic tool called generalised
entropy accumulation and can handle generic prepare-and-measure protocols
directly without switching to an entanglement-based version.
