[OC] terminal TCP Chat with encryption end to end C++

Author : JONSON
Publish Date : 2021-03-21 10:29:45
[OC] terminal TCP Chat with encryption end to end C++

NCURSES Encrypted TCP Chat

This is an encrypted chat via the command line! It was done using ncurses to build the whole user interface. I wanted to do a client-server example of a chat, were also the messages would be encrypted from end to end.

Upon accepting the connection of a new client, the first message the server gets is the public key from the client, which is later sent to all listening sockets (clients). The messages are first encrypted using logged client's public keys before being sent to back to the server. Other listening clients will unencrypt their messages by using their private key.

The project consists of 3 main parts,

    TCP Server -> you could use ngrok to accept network trafic on a dedicated port, and be like a real chat!
    Terminal user interface

In the gifs below, the right terminal was opened using telnet (install on linux) to showcase how a person not using the client would see the messages from users using this project's client.
Official Client     Connected using telnet

The example below showcases two clients, were the messages are encrypted end to end.
Official Client A     Official Client B

Conntact me on twitter Tweet | Create an issue
Table of Contents

    Motivation and Disclaimer

Motivation and Disclaimer

What can I say, I love ncurses and I wanted to do an example of something that required encryption, the idea of a TCP Chat was the first thing that came into my mind.

This was just a project made out of curiosity, the use that you might give to this tool is at your own risk.

This command line TCP Chat was built using ncurses.

The server is running constantly, and could also be used on a raspberry pi in combination with ngrok. By doing so, you could open your chat to other peers and have a secure way of messaging.

The client has a nice UI to be used on the terminal. The client first connects to the server and sends its public key to the server. The server retrieves this information and sends it to all users using this client.

Every client will then encrypt their messages with the other listening clients' public keys. The server will then get each corresponding listening client's message and send it accordingly.

Once the encrypted message is received on the other clients' side, it is unencrypted using the user's private key.

The client renews its key pairs everytime you start it.

Once the installation has been done,

As per default, the port to which the server is connecting to is 54000

Starting the Server (In case you are running the server)

source silver_server

Starting the Client

source silver_sniffle -a 54000 and the port 54000 could be changed for example to your own TCP address if you've got one. Of course, the server would have to be running on that address.

    ncurses sudo apt install libncurses5-dev libncursesw5-dev
    Open SSL sudo apt-get install libssl-dev
    cmake sudo apt-get -y install cmake


Clone this repository like so,

git clone https://github.com/edghyhdz/silver-sniffle.git

Once inside the root project folder silver-sniffle,

# Lets start by creating the build directory
mkdir build && cd build

# cmake that guy
cmake ..

# Finally
source install.sh

install.sh will run the final installation that will create a terimal shortcut named silver_server and silver_sniffle.

The final project folder structure is the following,

├── ...
├── build                     # Directory were project was built
│   ├──silver_server          # Server executable
│   ├── executable            # Client executable location
│   │   └─── silver_sniffle   # Client executable
│   └── certificates          # key pair location
└── ...

If everything was done allright, you should be able to run the server by doing the following,

source silver_server

Once the server is up and running, you should be able to run the client like so,

source silver_sniffle -a 54000

You can always re-route the client to another address.

The most relevant references are the following,

    Part of this code was taken from user Sloan Kelly, and adapted to this script to run on linux and work with Ncurses link to his repo here
    To encryt the messages, I took the this code snippet from ProgrammerSought as an example
    Finally, to generate the key pairs I used this code snippet from Dynamsoft

More references can be found inside the code.

















Category : general

Administrators have washed their hands and denounced others since Jesus painful killing

Administrators have washed their hands and denounced others since Jesus painful killing

- Handwashing has significant consideration this earlier year during Covid pandemic, not for neatness. it might have encountered a segment of the various charges

Download Latest Google GSuite Dumps

Download Latest Google GSuite Dumps

- GSuite Exam, GSuite questions, GSuite practice test, GSuite practice exam, GSuite dumps, GSuite Exam Dumps, GSuite exam questions,

Nonton Tokyo Revengers Full Movie Sub Indo Live Action

Nonton Tokyo Revengers Full Movie Sub Indo Live Action

- watching movies with subtitles, and guide you through the process of finding and enjoying the

Developing Blockchain Applications With Flutter

Developing Blockchain Applications With Flutter

- Developing Blockchain Applications With Flutter A blockchain is a decentralized database that everyone can access.