/RSA-based-chat-application

A django based chat application where you can send messages encrypted using RSA algorithm.

Primary LanguagePython

RSA-based-chat-application

A django based chat application where you can send messages encrypted using RSA algorithm.

Make sure you install all dependencies first. Open the project directory and run the following commands:

pip install django
pip install channels
pip install channels-redis
pip install redis

Setting up the database:

python manage.py makemigrations
python manage.py migrate

Run the local server using the command

sudo docker run -p 6379:6379 -d redis:2.8
python manage.py runserver

Usage and snapshots

You can set up your account by entering details in the registration form.

Alt text

After you sign up, it takes you to the login page where you can enter your credentials and log in.

Alt text

After successful login, it takes you to the home page. This application provides 2 main features.

  • Creating Chatrooms - private/public
  • Joining Chatrooms

It also displays the registered users.

Alt text

Click on the Create Room button and then enter the room name. You can create private/public rooms.

Alt text

For private rooms, it needs a password

Alt text

The below image shows the room page and you can enter your message inside the box provided on the right side. Once the message has been typed, you can click on the Encrypt button to encrypt your message. You can perform encryption using different sized keys(128 bits, 256, 512, 1024, 2048)

Alt text

The encryption process can be seen on the terminal output. It generates a public key and encrypts your message using it.

Alt text

Alt text

You can open up an incognito window and login with another user's credentials and join the same room. When the other user finishes encryption, he can hit the SEND ENCRYPTED MESSAGE button to send the encrypted message. The user on the incognito window can hit the DECRYPT button to create a private key using the public key with which the message was encrypted and can decrypt the message.

Alt text

The other user gets the public key used along with the enciphered text.

Alt text

On clicking the DECRYPT button, it takes us to this page

Alt text

You can view the decrypted message here

Alt text

All the messages which have been decrypted are stored in a chat log.

Alt text