  Quantum key distribution (QKD) provides a physical-based way to conciliate
keys between remote users securely. Simulation is an essential method for
designing and optimizing QKD systems. We develop a universal simulation
framework based on quantum operator descriptions of photon signals and optical
devices. The optical devices can be freely combined and driven by the photon
excitation events, which make it appropriate for arbitrary QKD systems in
principle. Our framework focuses on realistic characters of optical devices and
system structures. The imperfections of the devices and the non-local
properties of a quantum system are taken into account when modeling. We
simulate the single-photon and Hong-Ou-Mandel (HOM) interference optical units,
which are fundamental of QKD systems. The results using this event-driven
framework agree well with the theoretical results, which indicate its
feasibility for QKD.
