  Prepare and measure quantum key distribution protocols can be decomposed into
two basic steps: delivery of the signals over a quantum channel and
distillation of a secret key from the signal and measurement records by
classical processing and public communication. Here we formalize the
distillation process for a general protocol in a purely quantum-mechanical
framework and demonstrate that it can be viewed as creating an ``effective''
quantum channel between the legitimate users Alice and Bob. The process of
secret key generation can then be viewed as entanglement distribution using
this channel, which enables application of entanglement-based security proofs
to essentially any prepare and measure protocol. To ensure secrecy of the key,
Alice and Bob must be able to estimate the channel noise from errors in the
key, and we further show how symmetries of the distillation process simplify
this task. Applying this method, we prove the security of several key
distribution protocols based on equiangular spherical codes.
