Security Analysis of Quantum Key Distribution: Methods and Applications