A secure, chunked file-upload system with hybrid cryptography (RSA for key exchange, AES for data), a macOS GUI client (Tkinter), Ubuntu servers (C), and MongoDB Atlas for user authentication and file metadata. Designed for large files and reliable transmission with integrity.
- Hybrid cryptography: RSA key exchange, per-session AES key for data encryption.
- Chunked uploads: Splits large files, encrypts each chunk, transmits, and reassembles on the server.
- User authentication: MongoDB Atlas stores hashed credentials and file metadata.
- Cross-platform GUI: Built with Tkinter for login, signup, and file uploads.
- Dual secure channels:
- Port
9100→ Key Exchange Server - Port
9191→ Chunk Receiver Server
- Port
- Client generates RSA keypair → sends public key to Key Exchange Server.
- Server encrypts an AES session key with client public key → client decrypts with private key.
- Client splits file → AES-encrypts each chunk → sends to Chunk Receiver Server.
- Server decrypts & reassembles chunks → writes final file.
- MongoDB Atlas logs user + file metadata (username, file name, size, chunk count, timestamps).
- Python 3.10 or newer
- Pip packages:
pycryptodome,pymongo,python-dotenv - Tkinter (for GUI)
- macOS (python.org installer includes Tk)
- Ubuntu/Debian:
sudo apt-get install -y python3-tk
- Build tools:
gcc,make,pkg-config - OpenSSL headers:
libssl-dev
- sudo apt-get update
- sudo apt-get install -y build-essential pkg-config libssl-dev
- git clone (https://github.com/jaidevreddy/Chunk-Based-Encrypted-Uploads)
- cd Chunk-Based-Encrypted-Uploads
Replace the placeholders below with your actual values before running:
<MONGODB_URI>— your MongoDB Atlas SRV connection string<KEY_EXCHANGE_HOST>— host/IP of the Key Exchange Server (default port9100)<CHUNK_RECEIVER_HOST>— host/IP of the Chunk Receiver Server (default port9191)<CHUNK_SIZE_BYTES>— size of each chunk in bytes (e.g.,1048576for 1 MiB)
These values are read by the client code (via environment variables or arguments) depending on your implementation.
If your client expects environment variables, export them as shown in Step 4.
- cd client
- python3 -m venv .venv
- source .venv/bin/activate
- pip install pycryptodome pymongo python-dotenv
-
cd ../servers/key_exchange
-
cd ../chunk_receiver
Before running the servers, generate RSA key pairs for secure key exchange. Run this on the server (or client if your implementation requires local keys):
-
openssl genrsa -out private_key.pem 2048
-
openssl rsa -in private_key.pem -pubout -out public_key.pem
-
Keep
private_key.pemsecret and never commit it to Git. Sharepublic_key.pemwhere needed for encryption.
- cd servers/key_exchange
- ./key_exchange 9100
- cd servers/chunk_receiver
- ./chunk_receiver 9191
- cd client
- source .venv/bin/activate
- python gui.py
- Login/Signup in the GUI.
- Select a file → client performs RSA key exchange, encrypts chunks with AES, and uploads.
- Verify the file and metadata in MongoDB Atlas (users + files collections).
- Handshake fails: verify server IP/ports and RSA keypair generation.
- Corrupt output: confirm AES mode/IV/tag are identical on client and server.
- Mongo errors: validate
MONGODB_URIand IP allowlist in MongoDB Atlas. - Tkinter missing: install
python3-tkon Linux.