  Quantum key distribution (QKD) promises unconditionally secure key generation
between two distant parties by wisely exploiting properties of quantum
mechanics. In QKD, experimental measurements on quantum states are transformed
to a secret key and this has to be done in accordance with a security proof.
Unfortunately, many theoretical proofs are not readily implementable in
experiments and do not consider all practical issues. Therefore, in order to
bridge this "practical gap", we integrate a few existing theoretical results
together with new developments, in effect producing a simple and complete
recipe for classical post-processing that one can follow to derive a secret key
from the measurement outcomes in an actual QKD experiment. This integration is
non-trivial and our consideration is both practical and comprehensive in the
sense that we take into account the finiteness of the key length and consider
the effects on security of several essential primitives (including
authentication, error handling, and privacy amplification). Furthermore, we
quantify the security of the final secret key that is universally composable.
We show that the finite-size effect mainly comes from phase error estimation.
Our result is applicable to the BB84 protocol with a single or entangled photon
source.
