GithubHelp home page GithubHelp logo

decrypto's Introduction

Decrypto

Decrypto is a symmetric key mechanism for a secure chat server/client scenario, using the openSSL toolkit.

Communication and Key Exchange Protocol between client and server

The client only loads it's private key and server's public key and the server only loads its private key, the client’s public key and the AES key. So, the server and the client know the public key of each other.

When the client wants to contact the server, the following process take place:

  1. The client sends to the server a "hello" message. The message will be encrypted using the client's private key and then with the server's public key.

  2. When the message is received from the server, it will be descrypted using the server's private key and then with the client's public key.

  3. Now, if the message is decrypted correctly(the first message is "hello") the server will encrypt the AES key(it will be loaded from the aes_key.txt) and use the same steps as before to send it to the client i.e. encrypt it with the server's private key and then with the client's public key.

  4. Then, the client will decrypt the message that contains the symmetric key by decrypting it with the client's private key and then with the server's public key and store it in a varriable in order to use it for the rest of the communication process.

  5. After the above steps, the client and the server will use symmetric cryptography in order to encrypt/decrypt messages exhanged between them. The client will use the message obtained by the command line, encrypt it with the exchanged AES key and send it back to the server.The server is now able to decrypt the message with the AES key and print it on the screen.

The AES implementation uses AES-CBC 128 bit mode.

Quick Start

Clone the repo and execute the Makefile.

https://github.com/zagaris/Decrypto
cd Decrypto
make all

You have to run the server executable first and then the client executable. The default port for the server is 6000, but you can specify a different port via the -p parameter in the server executable

./server
./client -i 127.0.0.1 -p 6000 -m "hello"

Also, you can terminate the communication by sending the message quit to the server.

Generate your keys

You can generate your own RSA keys with openSSL commands.

openssl genrsa -out cli_priv.pem 2048
openssl rsa -in cli_priv.pem -pubout > cli_pub.pem
openssl genrsa -out srv_priv.pem 2048
openssl rsa -in srv_priv.pem -pubout > srv_pub.pem

decrypto's People

Contributors

zagaris avatar

Stargazers

Roman 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.