Secure cryptographic channel demonstrating ECDH key exchange, AES-256-GCM authenticated encryption, and HMAC integrity. Used in Experiment 1 of PRES-EDU-SEC-101 — Computer Security.
git clone https://github.com/presidio-v/presidio-hardened-crypto-channel.git
cd presidio-hardened-crypto-channelRecommended: create a local virtual environment and install dependencies with the included helper:
python bootstrap.pyActivation is optional. Run commands through the virtual environment interpreter directly if shell policy prevents activation:
# macOS or Linux
.venv/bin/python main.py --demo keyexchange --parties Alice Bob
# Windows PowerShell
.\.venv\Scripts\python.exe main.py --demo keyexchange --parties Alice BobFor the experiments below, use the virtual environment interpreter in place of
python when the environment is not activated.
python main.py --demo keyexchange --parties Alice BobBoth parties derive identical session keys without transmitting the secret.
python main.py --demo symmetric --message "Hello from Alice" --key-size 256python main.py --demo channel --client Alice --server Bob --messages 10python main.py --demo channel --no-hmac --tamperWithout authentication, a tampered message is detected by the GCM tag — demonstrating that AES-GCM provides both confidentiality and integrity.
python main.py --demo channel --messages 100 --duration 60
python report.py --experiment 1--no-hmac --tamper: AES-GCM's auth tag catches the flip —InvalidTagraised--tamper(HMAC on): HMAC check fires first, before decryption attempt- Key takeaway: encryption provides confidentiality; GCM tag / HMAC provides integrity
src/presidio_crypto_channel/
├── keyexchange.py X25519 ECDH + HKDF
├── symmetric.py AES-256-GCM
├── channel.py Full channel with optional HMAC
└── security.py Logging + pip-audit
MIT
This repository is developed under the Presidio hardened-family SDLC: https://github.com/presidio-v/presidio-hardened-docs/blob/main/sdlc/sdlc-report.md.