Skip to content

mukhulmanicka/whispr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Secure Messaging System - Installation & Setup

Requirements

Before running the secure messaging system, you need to install the required dependencies:

pip install cryptography

Project Structure

The secure messaging system consists of two main components:

  1. Server (server.py) - Handles client connections, key exchange, and message routing
  2. Client (client.py) - GUI application for users to send and receive encrypted messages

Features Implemented

🔐 End-to-End Encryption

  • 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

🏗️ Architecture

  • 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

🛡️ Security Features

  • Public key infrastructure for secure key exchange
  • Unique AES key for each message
  • Caesar cipher preprocessing
  • Message integrity and privacy protection

How to Run

1. Start the Server

First, run the server in one terminal:

python3 server.py

The server will start listening on localhost:12345 by default.

2. Start Client(s)

In separate terminals, run the client application:

python3 client.py

You can run multiple clients to test the messaging between different users.

Usage Instructions

Connecting to Server

  1. Enter a unique username
  2. Specify server address (default: localhost:12345)
  3. Click "Connect"

Sending Messages

  1. Select a recipient from the dropdown
  2. Set Caesar cipher shift value (0-25)
  3. Type your message
  4. Click "Send Encrypted Message" or press Enter

Security Process

  1. Message Input: User types plaintext message
  2. Caesar Encryption: Message encrypted with specified shift
  3. AES Encryption: Caesar-encrypted message encrypted with unique AES key
  4. RSA Encryption: AES key encrypted with recipient's public key
  5. Transmission: Encrypted key and message sent to server
  6. Decryption: Recipient reverses the process to read the message

Technical Details

Encryption Flow

Original Message → Caesar Cipher → AES Encryption → RSA Key Exchange → Secure Transmission

Key Management

  • 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

Network Protocol

  • JSON-based message protocol
  • Base64 encoding for binary data
  • Real-time socket communication
  • Automatic user list updates

Customization

Server Configuration

You can modify the server host and port in server.py:

server = SecureMessagingServer(host='0.0.0.0', port=8080)

Client Configuration

Default server address can be changed in the client GUI or modify the default in client.py.

Encryption Parameters

  • RSA key size: Currently 2048 bits (can be increased for more security)
  • AES key size: 256 bits
  • Caesar shift: Configurable 0-25

Security Notes

⚠️ Important: This is a demonstration/educational implementation. For production use, consider:

  • Certificate-based authentication
  • Perfect forward secrecy improvements
  • Message authentication codes (MAC)
  • Protection against timing attacks
  • Secure key storage
  • User authentication beyond usernames

Troubleshooting

Common Issues

  1. Connection Refused: Make sure server is running first
  2. Username Taken: Choose a different username
  3. Encryption Errors: Ensure recipient is online and keys are exchanged
  4. Module Not Found: Install cryptography package with pip

Debug Tips

  • Check server terminal for connection logs
  • Verify firewall settings if connecting remotely
  • Ensure Python version compatibility (3.6+)

About

An end to end encrypted messaging system built in Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages