Secure Chat is my attempt at creating a C program allowing you host decentralized system and chat securely with your friends. It implements HTTPS connection (✔️) and AES algorithm is used for message end-to-end (EE2E) encryption (❌). Messages are stored in SQLite3 database and can be read by the recipient only. Sending messages in optimized for maximum performance and resource usage.
Important
This project was not completed successfully and awaits second iteration.
- Security Measures
- Getting Started
- Components
- Current work
- License
- Authors
- Contributing
- Acknowledgments
The application uses the OpenSSL library for HTTPS connection, encryption, and decryption. The server acts as a buffer and router for clients. The following algorithms are used:
- AES algorithm: Used to encrypt and decrypt messages between clients.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
For a Debian-based system, you can install the following packages:
sudo apt install git gcc make sqlite3 libz-dev xorg-dev libc6-dev libxi-dev libssl-dev libuv1-dev libx11-dev libxrandr-dev libsqlite3-dev netcat-openbsd libasound2-dev libwayland-dev build-essential mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libcurl4-openssl-dev libxkbcommon-x11-dev libxkbcommon-dev
This should also work with Ubuntu and Linux Mint.
git clone https://github.com/milosz275/secure-chat
cd secure-chat
make
Run the server and client executables in separate terminals.
server/build/bin/server
client/build/bin/client
You can download server and client from the releases page.
You can also run the server using Docker.
docker pull mlsh/secure-chat
docker run -d -p 12345:12345 mlsh/secure-chat
Server is responsible for handling client connections, retrieving messages from the database and sending messages to the recipients. It also manages user registration and authentication according to the protocol. Multithreading is used to allow many concurrent requests and connections. Client connections are stored in a thread-safe hash map and only one logged instance of a client is allowed. Messages before handling are stored in thread-safe queue. Server facilitates CLI for system administration. Server logs all requests, client connections and errors.
Client connects to the server, sends messages and receives messages from the server. GUI is implemented using Raylib library and dark-mode is added. Dynamic signal resolution is used to allow for the best performance and resource usage. States are used to manage the client's connection and message sending. Client logs all requests, server connections and errors.
Common generates static library that is used by both server and client, i.e. communication protocol, encryption and decryption functions. It also defines the message structure, signal codes, data structures and functions that are shared between server and client.
SQLite3 database is utilized at the moment. There is planned usage of distributed database system Cassandra or MongoDB in the further project iterations.
Navigate to database for detailed database schema documentation.
- Graphical user interface
- Direct message E2EE encryption
- Group chat support
- Broadcast message support
- Database message save and synchronization
- Message history loading
- Server instances connection and synchronization
- User activity tracking and polling (kick afk, statistics)
- Server command line interface for system administration (!exit, !ban, !kick, !mute, !shutdown)
- Protocol signal codes ("User is typing...", "User has read the message", "User has joined the chat")
- Server logging (requests, client connections, errors)
- IP banning and rate limiting
- Server start arguments using argv[], argc and/or configuration file (port, database, log level)
- Interpreter for server automation
This project is licensed under the MIT License - see the LICENSE file for details.
Please refer to CONTRIBUTING.md. We appreciate your help!