Before running the secure messaging system, you need to install the required dependencies:
pip install cryptographyThe secure messaging system consists of two main components:
- Server (
server.py) - Handles client connections, key exchange, and message routing - Client (
client.py) - GUI application for users to send and receive encrypted messages
- RSA Encryption: Used for secure asymmetric key exchange (2048-bit keys)
- AES Encryption: Used for fast symmetric encryption of message content (256-bit keys)
- Caesar Cipher: Additional layer of encryption as specified in requirements
- Client-Server Model: Python socket-based real-time communication
- Multi-threaded Server: Handles multiple clients simultaneously
- Modern GUI: Built with tkinter for user-friendly interface
- Public key infrastructure for secure key exchange
- Unique AES key for each message
- Caesar cipher preprocessing
- Message integrity and privacy protection
First, run the server in one terminal:
python3 server.pyThe server will start listening on localhost:12345 by default.
In separate terminals, run the client application:
python3 client.pyYou can run multiple clients to test the messaging between different users.
- Enter a unique username
- Specify server address (default:
localhost:12345) - Click "Connect"
- Select a recipient from the dropdown
- Set Caesar cipher shift value (0-25)
- Type your message
- Click "Send Encrypted Message" or press Enter
- Message Input: User types plaintext message
- Caesar Encryption: Message encrypted with specified shift
- AES Encryption: Caesar-encrypted message encrypted with unique AES key
- RSA Encryption: AES key encrypted with recipient's public key
- Transmission: Encrypted key and message sent to server
- Decryption: Recipient reverses the process to read the message
Original Message → Caesar Cipher → AES Encryption → RSA Key Exchange → Secure Transmission
- Each client generates a 2048-bit RSA key pair
- Public keys are exchanged through the server
- AES keys are generated per message for perfect forward secrecy
- Caesar shift can be adjusted per message
- JSON-based message protocol
- Base64 encoding for binary data
- Real-time socket communication
- Automatic user list updates
You can modify the server host and port in server.py:
server = SecureMessagingServer(host='0.0.0.0', port=8080)Default server address can be changed in the client GUI or modify the default in client.py.
- RSA key size: Currently 2048 bits (can be increased for more security)
- AES key size: 256 bits
- Caesar shift: Configurable 0-25
- Certificate-based authentication
- Perfect forward secrecy improvements
- Message authentication codes (MAC)
- Protection against timing attacks
- Secure key storage
- User authentication beyond usernames
- Connection Refused: Make sure server is running first
- Username Taken: Choose a different username
- Encryption Errors: Ensure recipient is online and keys are exchanged
- Module Not Found: Install cryptography package with pip
- Check server terminal for connection logs
- Verify firewall settings if connecting remotely
- Ensure Python version compatibility (3.6+)