Skip to content

christiansassi/advanced-programming-of-cryptographic-methods-project

Repository files navigation


Table of Contents

Introduction

The Rust Unique Secure Talk (T.R.U.S.T.) is a secure chat application with a terminal user interface (TUI), developed in Rust. This project focuses on exploring secure communication principles and implementing a robust end-to-end encryption system for reliable and private messaging.
The core of the project revolves around the Extended Triple Diffie-Hellman (X3DH) protocol for secure key establishment and Double Ratchet protocol for frequent key update. Once a shared secret is established, the application switches to AES-GCM for symmetric message encryption. Together, these algorithms ensure end-to-end confidentiality and integrity of all communications.

Installation and Configuration

Getting Started

  1. Clone the repository:
git clone https://github.com/christiansassi/advanced-programming-of-cryptographic-methods-project
  1. Navigate to the project directory:
cd advanced-programming-of-cryptographic-methods-project

Configuration

Modify the config.toml file located in the config directory to adjust the application settings:

  • server_ip: The IP address of the server (default: server). If you do not plan to use Docker (see Installation from Source), set this to 127.0.0.1 or another valid IP address.
  • server_port: The port on which the server listens (default: 3333).
  • log_level: The logging level (default: info).

Warning

Do not modify private_key_server and public_key_server. These values are automatically generated by the updater.

Installation

You can choose between installing the project using Docker (the default and recommended method) or building the executables manually. The Docker-based approach is recommended because it minimizes compatibility issues by encapsulating all dependencies within containers. Local installation is less user-friendly but still fully functional. All installation methods offer the same features. Choose the one that best fits your environment and preferences.

Note

If you prefer not to use Docker and want to avoid building everything from source, pre-built binaries are available in the target/release folder, except for macOS. If you are using macOS, you will need to build the source files manually. See Installation from Source.

Installation with Docker (Recommended)

  1. Verify that Docker is installed by running:
docker --version
  1. Build the Docker image:
docker compose build --no-cache
  1. Run the updater to generate server keys:
docker compose run --rm updater
  1. Start the server and clients:
docker compose up server client1 client2
  1. Open a new terminal and attach to the TUI of client1:
docker container attach client1
  1. Repeat the previous step for client2, if desired.
  2. To stop the containers, press CTRL+C in the terminal where you ran docker compose up, or run docker compose down.

Installation from Source

  1. Ensure that Rust and Cargo are installed by running:
rustc --version
cargo --version
  1. Build all components (server, tui, updater) by running the following command from the root fo the repository:
cargo build --release
  1. The built executables will be located in the target/release folder.

    1. First, update the server keys by running the updater executable.
    2. Then, start the server by running the server executable.
    3. Finally, run any number of clients (as needed) using the tui executable.

Warning

The executables require access to the config.toml file. Therefore, you must run them from the root directory of the repository.

Getting Started

Server

Client

The client operates in two modes:

  • NORMAL: Entered by pressing the ESC key. This mode allows interaction with the TUI. For a list of available key combinations, check the bottom of the TUI for instructions relevant to the current window.

  • INPUT: Entered by pressing the i key. As the name suggests, this mode allows you to input text into the application’s input fields.

Registration

Before using the client, you need to register by choosing a unique username. Usernames must be non-empty and unique—multiple users cannot share the same username simultaneously.

Registration Screen

Main Window

After registration, you'll be taken to the main window. Initially, your chats list will be empty.

Empty Chat List

Adding Friends

To start chatting, you can add new friends at any time by pressing the a key in NORMAL mode.

Warning

The person you want to chat with must be online.

Add a Friend

Navigating Chats

While in NORMAL mode:

  • Use the left/right arrow keys to switch between the chats list and the selected chat.
  • In the chats list:
    • Use the up/down arrow keys to navigate through your chats.
    • Press ENTER to select a chat and start messaging.


Bob and Alice chatting

Resources

Report

Report

Documentation

The Rust Unique Secure Talk (T.R.U.S.T.)

Contacts

Matteo Bordignon - [email protected]

Alessandro Perez - [email protected]

Christian Sassi - [email protected]

https://www.unitn.it/

About

Project developed by Matteo Bordignon (@Bordi00), Alessandro Perez (@AlessandroPerez) and Christian Sassi for the Advanced Programming of Cryptographic Methods course.

Topics

Resources

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •