Skip to content

A simple chat client and server with messages sent encrypted using the RSA algorithm.

License

Notifications You must be signed in to change notification settings

adelnobel/RSA-Chat-Client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

RSA Chat Client

This is a simple chat server that uses RSA for encrypting the messages between the client and the server written in java.

Three NetBeans projects are included.

RSAClient

This is the chat client.

RSAServer

This is the chat server. This is supposed to create a connection and listen on the specified port waiting for an RSAClient to connect.

RSAKeyCenter

This is a KDC (Key Distribution Center), its task is to create both private and public keys for any chat client or server that connects to it.

How It Works

The KDC provides a a public and private key for both client and server, here are the steps to use it

  • Open the KDC and leave the window open

  • Open the chat server, you should get a message saying that it's waiting for connections, if you didn't do step 1 you will get "Couldn't connect to KDC error!". The server will communicate with the KDC to generate a public & private key for itself. The KDC server will save the public key along with the ID of the server in a database for future requests from clients who want to get the public key of the server (SQLite database was used for this purpose)

  • Open the chat client and it should establish a connection with the KDC to generate its public & private keys Then a connection will be established with the chat server, if the KDC or the chat server were not running you will get an error.

Notes:

  • 1- The server ip, port, key length, server id, client id, KDC port are defined STATICALLY within their correspondeing classes, they can be changed.

  • 2- Currently, the message length is assumed to be (LESS THAN) key length / 8 , to ensure that when the ascii message is converted to integer, that integer will be less than the MODULUS n. Otherwise the message will be congruent to a number less than n and the message will be lost after applying the modulo operation. The correct way to do this is by making all messages of uniform size that's less than the key length but this feature is NOT IMPLEMENTED. Currently, the default key length is 1024, therefore a message length should roughly be less than 128 characters otherwise it won't be encrypted/decrypted correctly!

IMPORTANT

This project was made for deonstration purposes ONLY which means it can NOT be used for secure messaging as the keys generated by the KDC are NOT encrypted and are sent across the network in plain form! One correct way to do this is to encrypt the keys by a symmetric key encryption algorithm like DES, but as said earlier, this was made for demonstration purposes only.

LICENSE

GNU GPL v2.0

About

A simple chat client and server with messages sent encrypted using the RSA algorithm.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages