Git Product home page Git Product logo

openssl_chat's Introduction

OpenSSL Online Chat

This repository contains the final project of Applied Cryptography course (Master's Degree in Cybersecurity at University of Pisa). The project has been developed for educational purposes and represents a multithread client-server chat application in which every communication between peers is encrypted using OpenSSL APIs.

How it works

When a client correctly connects to the server, the server will show a list of online users to this client, then the client can request a chat session with other clients. This client will wait for the peer response. As for now there are 3 users registered to the server. If you want to create your own client, you should generate a pair of 2048-bit RSA keys and the private key must be protected by password. The server has a public certificate that is granted to be safe by the CA SimpleAuthority.

Prerequisites

The programs needs the installation of OpenSSL, a TLS/SSL and crypto library, and SimpleAuthority, a trusted CA.

Install on Ubuntu/Debian

First of all, install build dependencies, then clone OpenSSL and configure it.

sudo apt-get -y install build-essential checkinstall git zlib1g-dev
git clone --depth 1 --branch OpenSSL_1_1_1g https://github.com/openssl/openssl.git
cd openssl
./config zlib '-Wl,-rpath,$(LIBRPATH)'

After you have built and tested, install OpenSSL and configure the shared libs.

make
make test
sudo make install
sudo ldconfig -v

Finally, check the OpenSSL version to make sure you have successfully completed all the steps.

openssl version

Install SimpleAuthority

To generate a certificate, install SimpleAuthority at the following link: SimpleAuthority

2048-bit RSA Generation

Before running the program , the user should generate a pair of 2048-bit RSA keys using OpenSSL command-line tools.

  • RSA private key: the following command generate a .pem file, protected by a user-chosen password, containing a 2048-bit key.
openssl genrsa -aes128 -out private_key.pem 2048
  • RSA public key: a private key in OpenSSL is represented with a strcuture that contains also the public key, so the following command extract the public key from the private key.
openssl rsa -pubout -aes128 -in private_key.pem -out public_key.pem

Usage

Before running the programs, you have first to compile them with -lcrypto flag, in order to include crypto features of OpenSSL, and -lpthread flag.

cd server/src
g++ main_server.cpp -lcrypto -lpthread -o server.out
./server.out

cd client/src
g++ client_test.cpp -lcrypto -lpthread -o client_test.out
./client_test.out

Authors

openssl_chat's People

Contributors

fcarli3 avatar

Stargazers

GaMa Chowdary avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.