Welcome to E2EE-Python, the most impenetrable, military-grade cryptographic fortress ever engineered for digital communication! This isn't just a chat applicationβit's an absolute masterclass in unyielding, mathematical invincibility. Built from the ground up to withstand the computing power of the next century, E2EE-Python weaponizes advanced Elliptic Curve Cryptography and unbreakable AES-256-GCM encryption to ensure your secrets remain yours until the end of time.
Whether you're a cyberpunk traversing the digital underground, a covert operative, or a privacy purist demanding absolute secrecy, this system guarantees that not even the world's most powerful supercomputers can intercept a single syllable of your conversations!
Forget relying on black-box security and "trust us" promises. E2EE-Python implements a secure two-way chat system that explicitly demonstrates its raw, unadulterated cryptographic power right before your eyes. Every handshake, every key exchange, and every encrypted packet is laid bare for you to witness the birth of a perfectly secure channel.
Features:
- ECDH Key Exchange with SECP256R1 curve
- HKDF Key Derivation with SHA-256
- AES-256-GCM Encryption with random nonces
- Forward Secrecy with ephemeral keys
- Turn-based Communication for reliability
The primary goal is to demonstrate:
- ECDH key exchange with SECP256R1 curve
- Session key derivation using HKDF-SHA256
- AES-256-GCM symmetric encryption
- Forward secrecy through ephemeral keys
- Message framing over raw TCP
- Comparison with TLS implementation
- Key Exchange: Elliptic Curve Diffie-Hellman (SECP256R1)
- Key Derivation: HKDF with SHA-256, 256-bit output
- Encryption: AES-256-GCM with random nonces
- Forward Secrecy: Ephemeral keys destroyed after session
- Transport: Raw TCP with length-prefixed message framing
- Authentication: GCM authentication tags
- Turn-based: Reliable message delivery without threading issues
- Install dependencies:
pip install -r requirements.txt- The application uses Python 3.10+ with the
cryptographylibrary.
The application provides both Command-Line Interface (CLI) and Graphical User Interface (GUI) versions.
The GUI version combines server and client capabilities into a single application.
# 1. Run the app (choose one)
python gui_dark.py # Dark theme
python gui_light.py # WhatsApp style
# 2. Click "Start as Server" on one computer
# 3. Click "Connect as Client" on another
# 4. Start chatting securely!Terminal 1:
python server.pyThe server will:
- Listen on port 5000
- Wait for client connection
- Perform ECDH key exchange
- Start encrypted chat
Terminal 2:
python client.pyThe client will:
- Connect to localhost:5000
- Perform ECDH key exchange
- Start encrypted chat
MINIMAL DEMO SERVER
======================================================
[*] Server listening on port 5000...
[+] Client connected: ('127.0.0.1', 51531)
[*] Performing ECDH key exchange...
[*] Sent public key
[*] Received client public key
[+] Session key established!
[*] Session key: c5ddd707aa8d1889ad41031e368ead09...
======================================================
SMS-STYLE CHAT ACTIVE
Type anytime - messages appear instantly!
======================================================
You: HI
You:
[Client]: Hello
You:
MINIMAL DEMO CLIENT
======================================================
[*] Connecting to localhost:5000...
[+] Connected!
[*] Performing ECDH key exchange...
[*] Received server public key
[*] Sent public key
[+] Session key established!
[*] Session key: c5ddd707aa8d1889ad41031e368ead09...
======================================================
SMS-STYLE CHAT ACTIVE
Type anytime - messages appear instantly!
======================================================
You:
[Server]: HI
You: Hello
You:
βββββββββββββββββββββββββββββββββββββββββββ
β User Interface Layer β
β (Console I/O, Mode Selection) β
βββββββββββββββββββββββββββββββββββββββββββ€
β Application Layer β
β (Message Handling, Session Mgmt) β
βββββββββββββββββββββββββββββββββββββββββββ€
β Security Layer β
β βββββββββββββββββββ¬ββββββββββββββββββ β
β β Custom Crypto β TLS Wrapper β β
β β (ECDH + AES) β (ssl module) β β
β βββββββββββββββββββ΄ββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββ€
β Transport Layer β
β (TCP Sockets, Message Framing) β
βββββββββββββββββββββββββββββββββββββββββββ
- Key Generation: Each party generates ephemeral ECDH key pairs
- Key Exchange: Public keys exchanged over insecure channel
- Shared Secret: ECDH computation produces shared secret
- Key Derivation: HKDF derives 256-bit session key
- Encryption: AES-256-GCM with unique nonces per message
- Turn-based Chat: Client sends, server replies (no race conditions)
- Cleanup: All key material destroyed on session end
- Ephemeral keys generated per session
- No long-term encryption keys stored
- Past communications remain secure even if current keys compromised
- Memory overwriting for sensitive data cleanup
Messages use length-prefixed framing:
[4-byte length][encrypted message]
Encrypted messages contain:
[nonce_len(4)][nonce][tag_len(4)][tag][ciphertext_len(4)][ciphertext]
Standard sizes:
- Nonce: 12 bytes (96 bits for GCM)
- Tag: 16 bytes (128 bits for authentication)
- Ciphertext: Variable length
Run the test suite:
python -m unittest discover tests -vThe application includes:
- Unit tests for all components
- Property-based tests using Hypothesis
- Cryptographic correctness validation
- Network protocol testing
- Self-signed certificates (not for production)
- Simplified error handling
- Educational focus over production hardening
- Use proper certificate management
- Implement comprehensive logging
- Add rate limiting and DoS protection
- Use hardware security modules for key storage
- Implement perfect forward secrecy rotation
βββ gui_dark.py # Dark theme GUI application
βββ gui_light.py # WhatsApp-style GUI application
βββ server.py # Server application (CLI)
βββ client.py # Client application (CLI)
βββ requirements.txt # Dependencies
βββ crypto/
β βββ engine.py # Cryptographic operations
β βββ interfaces.py # Crypto interfaces
βββ network/
β βββ manager.py # Socket management
β βββ tls_wrapper.py # TLS operations
β βββ interfaces.py # Network interfaces
βββ session/
β βββ manager.py # Session lifecycle
β βββ interfaces.py # Session interfaces
βββ common/
β βββ types.py # Shared data types
βββ tests/
βββ test_*.py # Unit tests
βββ test_*_properties.py # Property-based tests
This implementation demonstrates:
- Explicit Cryptography: Every cryptographic operation is visible
- Protocol Design: Message framing and session management
- Security Principles: Forward secrecy, authentication, integrity
- Industry Comparison: Custom vs TLS implementation differences
- Best Practices: Secure key handling and cleanup
This is educational software for demonstrating cryptographic principles.


