A research framework implementing dynamic hybrid key management that fuses Quantum Key Distribution (QKD), Post-Quantum Cryptography (PQC), and Classical Diffie-Hellman key exchange with intelligent, real-time mode switching.
This framework addresses the challenge of transitioning to quantum-safe cryptography by dynamically selecting the optimal key exchange mode based on real-time network conditions:
| Mode | Components | Use Case |
|---|---|---|
| QKD | BB84 protocol (Qiskit simulation) | Low-noise quantum channel available |
| PQC | Kyber512 KEM (liboqs / simulated fallback) | High latency or degraded quantum channel |
| Classical | Diffie-Hellman (2048-bit, pre-computed params) | Fallback when quantum resources unavailable |
| Hybrid-QKD-PQC | BB84 + Kyber, fused via HKDF | Balanced security and performance |
| Hybrid-Full | BB84 + Kyber + DH, fused via HKDF | Maximum security (three-layer fusion) |
A threshold-based decision engine monitors Quantum Bit Error Rate (QBER) and network latency to switch between modes automatically.
├── hybrid_key_framework.py # Core framework module
├── DynamicHybridFramework_Seeded_v2.ipynb # Main experiment notebook (seeded, reproducible)
├── Unoptimized_DynamicHybridFramework.ipynb # Unoptimized framework notebook
├── Unoptimized_DH_Baseline.ipynb # Baseline measurement (un-optimized DH)
├── generate_chapter4_figures.py # Figure generation scripts
├── generate_mode_usage.py # Mode usage distribution chart
├── save_figure_4_1.py # Figure 4.1 generation
├── verify_chapter4_data.py # Data verification utility
├── *.csv # Benchmark result datasets
├── requirements.txt # Python dependencies
└── .gitignore
- Python 3.10+
- Qiskit and Qiskit Aer for quantum circuit simulation
- cryptography library for DH and HKDF
- (Optional) liboqs-python for real Kyber512 KEM — the framework gracefully falls back to a simulated implementation if unavailable
# Clone the repository
git clone https://github.com/<your-username>/dynamic-hybrid-qkd-framework.git
cd dynamic-hybrid-qkd-framework
# Create and activate a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt# See https://github.com/open-quantum-safe/liboqs-python for platform-specific instructions
pip install liboqs-pythonfrom hybrid_key_framework import DynamicHybridKeyManager
manager = DynamicHybridKeyManager()
key, metrics = manager.generate_key()
print(f"Mode: {metrics.mode}")
print(f"Key: {key.hex()}")
print(f"Generation time: {metrics.generation_time_ms:.2f} ms")jupyter notebook DynamicHybridFramework_Seeded_v2.ipynbThe main notebook runs a full benchmark suite across all five modes with seeded randomness for reproducibility.
- Dynamic mode switching based on real-time QBER and latency thresholds
- HKDF-based entropy fusion combining keys from multiple cryptographic sources
- Reproducible experiments via seeded random number generators
- Cryptographically secure key material generation using Python's
secretsmodule - Graceful degradation — falls back to simulated PQC if liboqs is unavailable
- Pre-computed DH parameters for optimised performance (2000x+ speedup over naive generation)
The *.csv files contain benchmark results for each mode, including:
- Key generation time (ms)
- Entropy estimates
- Dynamic switching behaviour over 100-iteration runs
This project is part of academic research. Please contact the author for licensing information.