STEPS Engineering released 3 challenges for TYs to compete in, the first one of the involved creating a communication system to transfer data for over two metres. I developed a terminal chatroom that allows you to communicate to numerous people not only 2 metres apart but from all across the globe at the same time, this is all layered with basic end-to-end encryption.
Cryptochat allows users to connect to a common server that acts as a chatroom, all users connected to the server will be able to send and receive messages from each other.
ARCHITECTURE OR CRYPTOCHAT
The way my program communicates is actually a bit more complicated than depicted on FIG 1.1, it works is by having 2 socket types for each client to server connection, REQUEST-REPLY and PUBLISHER-SUBSCRIBER. I also use a library knows as 0mq to handle the stability of my socket architecture
The REQUEST-REPLY messaging pattern is very simple, the client sends a message, known as a request, to the server and the server answers back immediately with something. In other words, the client sends the message the user just typed in and the server sends back confirmation that it received the message.
Here is where the PUBLISHER-SUBSCRIBER method comes in. I needed to tell all the connected clients that a new message was sent, who sent it and what is said on it. Don’t forget that at this point the message is totally encrypted and the server has no idea what it contains and will never do so all it can do is transfer it. The clients are all “subscribed” with this PUB-SUB socket to the server, which at this points “publishes” or broadcasts an announcement saying the required info. The client receives it and proceeds to decrypt all the encoded data to then show the user visually.
Here you can see the Client initiating the connection on both sockets.
And this instead is the server binding to those ports. The server has to be activated before the client.
This is sort of what drives my program, the essential code in other words. Although there is much more code to make it fully work, Im not going to describe it all, but if you are interested I can send a link to my GitHub reposity.
PROOF OF CONCEPT
Now let’s put my application to the test, the following are screenshots from two different clients receiving and sending messages to each other.
This is the greeting screen to my application:
It has also a manual option for decrypting and encrypting text without sending it over chat.
Here I entered the chat menu and chose to connect with the default credentials, meaning tp the ones I have saved in the client code. Then it asks me to pick a username as it needs to know who is sending the messages. The rest are all mainly debugging logs to know what my program is doing.
This is a screenshot of the server receiving my message and broadcasting it to all listening clients, I have taken the encryption off for display purposes.
And this is another client signed in as “other user” receiving the messages that I sent from my PC.
Now I am working on remastering the graphics of my application, mainly for the chat screen. I am also working on the end to end encryption, I want to increase the level of encryption by changing the way I encrypt my data.
Here is the GitHub repository for my project: