  We present a practical method that can make quantum key distribution (QKD),
for the first time, both ultra-long-distance and immune to all attacks in the
detection system. This method is an important extension of the
measurement-device-independent QKD (MDI-QKD) - MDI-QKD with entangled photon
sources in the middle. By proposing a general model and simulating an
entanglement based QKD experiment, we find that MDI-QKD with one entangled
photon source in the middle can practically tolerate 77 dB combined loss (367km
standard telecom fiber) in the asymptotic limit, and it can still tolerate 60
dB combined loss (286km standard telecom fiber) in the finite-key case with
state-of-the-art detectors. Our general model can also be applied to other
non-QKD experiments involving entangled photon sources and Bell state
measurements.
