This project is a secure, peer-to-peer encrypted messaging system built with Python. It includes features for user registration, login, message encryption/decryption, and secure key management.
- User Authentication: Registration and login functionalities with password hashing.
- Public/Private Key Encryption: RSA keys are generated for each user to encrypt and sign messages.
- Message Encryption: Messages are securely encrypted with RSA and stored in a database.
- Persistent Data: Encrypted user data and messages are stored locally and on the server.
- Only for Linux at the moment
- Python 3.8+
- SQLite (for local database management)
git clone https://github.com/Enryou/BCYB_Project.git-
Create a virtual environment:
python -m venv venv
-
Activate the virtual environment:
source venv/bin/activate -
Install dependencies:
pip install -r requirements.txt
-
Run the
database_manager.pyscript to initialize the SQLite database:python database_manager.py
This will create a
messages.dbfile in the project directory.
-
Start the server by running:
uvicorn server_routes:app --reload
The server will be accessible at
http://127.0.0.1:8000.
- Run the client application:
python client.py
- Users register with a username and password.
- A pair of RSA keys (private and public) is generated.
- The private key is encrypted with the user's password and stored locally.
- The public key is uploaded to the server.
- Users log in with their credentials.
- The private key and secret key are loaded and decrypted locally.
- Messages are encrypted using the recipient's public key.
- The message and a digital signature are sent to the server.
- The server stores the encrypted message.
- Messages are retrieved from the server.
- The client decrypts the messages using the user's private key.
- Digital signatures are verified to ensure authenticity.
- Register: Register a new user.
- Login: Log in with an existing username and password.
- Send Message: Send an encrypted message to another user.
- Get Messages: Retrieve messages sent to the logged-in user.
- View Past Messages: View decrypted past messages stored locally.
- Logout: Logout from the current session.
- Password Validation: Passwords must meet strict complexity requirements.
- Encryption: RSA for key encryption and message exchange.
- Signature Verification: Ensures message integrity and authenticity.
client.py: Handles user interaction, encryption, and communication with the server.server_routes.py: Defines API routes for user registration, login, and message exchange.database_manager.py: Manages the SQLite database and ORM models.requirements.txt: Lists all the dependencies required for the project.