  Security formulas of quantum key distribution (QKD) with imperfect resources
are obtained for finite-length code when the decoy method is applied. This
analysis is useful for guaranteeing the security of implemented QKD systems.
Our formulas take into account the effect of the vacuum state and dark counts
in the detector. We compare the asymptotic key generation rate in presence of
dark counts with that without.
