This project is a secure chat application that uses RSA for key exchange and AES for encrypted communication between clients and the server. The server uses a graphical interface to manage and display incoming client messages. The clients have their own GUI to send and receive messages.
- RSA Encryption: Securely exchanges AES keys between the server and clients.
- AES Encryption: Symmetric encryption is used to encrypt all chat messages.
- GUI for Server: Displays chat messages and logs with the option to enable debugging.
- GUI for Clients: Chat interface for clients to send and receive messages.
- Multi-client support: The server can handle multiple clients simultaneously.
- Encrypted key exchange: Secure transfer of AES key using RSA encryption.
- The server generates an RSA key pair.
- The server sends the RSA public key to the client when it connects.
- The client generates a random AES key and encrypts it using the server's RSA public key.
- The client sends the encrypted AES key to the server.
- The server decrypts the AES key using its RSA private key.
- All further messages are encrypted with AES-256 using this key.
- Clients: Each client sends messages encrypted using AES-256. The client GUI provides a text area for entering messages, and sent messages are encrypted before transmission.
- Server: The server decrypts the AES-encrypted messages, logs them in the GUI, and forwards the encrypted message to other connected clients.
- Python 3.x
cryptography
library: To install, run:pip install cryptography
tkinter
: Pre-installed with Python for GUI creation.
encryption.py
: Contains the AES encryption and decryption methods.server.py
: The server-side script. Handles multiple clients, performs RSA key generation, and logs messages.client.py
: The client-side script. Connects to the server, handles AES key generation, and sends/receives encrypted messages.LICENSE
: Contains the licensing information for the project.
- Run the server by executing:
python server.py
- The server GUI will open, showing the chat logs and debug logs (if enabled).
- Press "Start Server" to begin listening for client connections.
- Run the client by executing:
python client.py
- A client GUI will open. Enter an alias and press OK.
- You can now send and receive encrypted messages in the chat.
- On the server GUI, you can enable the "Debug Mode" checkbox to view the encrypted and decrypted messages for debugging purposes.
.
├── encryption.py # AES encryption/decryption logic
├── server.py # Server-side logic with RSA key exchange and message handling
├── client.py # Client-side logic with AES key exchange and message handling
├── LICENSE # Project licensing information
└── README.md # Project documentation
- RSA is used for key exchange to protect the AES key during transmission.
- AES-256 is used for encrypting all chat messages.
- Messages exchanged between clients and server are protected from eavesdropping.
- Authentication: Add client authentication to ensure only authorized users can join.
- TLS/SSL: Use TLS for encrypted communication over sockets.
- Message Integrity: Implement HMAC or digital signatures to ensure message integrity.
This project was developed by: