A simple multi-core chat that involves the usage of RSA encryption.
Based on textbook RSA (prime numbers are close to 2^512)
To run, simply execute the server.py and then client.py-s one by one.
Then, just type some text into one of the user terminals and enjoy the result.
Suppose user Alice wants to send a secret message to user Bob. Then, we might want to build a protected connection between both of users.
This protected connection is our server.
The algorithm is the following:
- A server and Alice exchange public keys: server receives Alice public kay and Alice receives server public key.
- The same goes for Bob.
- Alice encrypts the message using server public key and somehow shows that it is for Bob. In our case, we chose message | id format to show that message message should be delivered to the client with id id.
- Server receives the message, decrypts it using it's own private key.
- Server decrypts the message using Bob's public key and sends it to Bob.
- Bob receives encrypted message using his private key and now can read the secret.
Checking of the message integrity is implemented: check whether the hash of the sent message before encoding is equal to the hash of the received message after decoding.
If id wasn't specified, we simply show message to all receivers.
The example of usage:
