Quantum Key Distribution (QKD) represents a paradigm shift in cryptographic security, offering information-theoretic confidentiality based on fundamental principles of quantum mechanics rather than computational hardness assumptions. The emergence of advanced quantum processors with ever-increasing qubit counts has accelerated the timeline for cryptographically-relevant quantum computers, necessitating immediate migration to quantum-safe communication protocols. This paper introduces a comprehensive QKD-based network integrity mechanism implemented as a Flask-based web chatting application that provides end-to-end security with real-time attack detection and automated mitigation. The system integrates a complete BB84 protocol simulation with polarized photon transmission modeling, incorporating realistic quantum channel parameters including attenuation (0.2 dB/km), dark count probability (10⁻⁶), and detector efficiency (30%). The architecture comprises four integrated modules: Quantum Key Distribution Engine implementing the full BB84 protocol stack with adaptive basis selection and error reconciliation; Secure Chat Interface supporting multi-user rooms, private messaging, and file sharing with one-time pad encryption using quantum-generated keys refreshed at optimal intervals; Network Integrity Monitor employing statistical analysis and machine learning techniques to detect eavesdropping attempts through quantum bit error rate (QBER) analysis, timing anomalies, and photon statistics; Automated Mitigation System that quarantines detected attackers through session termination, IP blacklisting, key revocation, and emergency key regeneration. Experimental evaluation demonstrates detection rates of 99.7% for intercept-resend attacks at 24.8% QBER, 98.2% for photon number splitting attacks at 15.3% QBER, and 99.1% for man-in-the-middle attacks at 18.7% QBER. The system achieves key generation rates of 1.82 kbps over 10 km simulated fiber, with 1.8-second quarantine response time meeting stringent incident response requirements. Scalability testing confirms support for 5,000+ concurrent users with 320 ms response time, making the solution suitable for production deployment. This work represents the first production-ready integration of quantum key distribution with a complete web chat application featuring automated attack detection and mitigation, bridging the gap between theoretical quantum cryptography and practical secure communication tools.
P et al. (Sat,) studied this question.