A live demonstration of private communication on a public channel.
We utilize simple web sockets via socket.io to create a central chat room that broadcasts all messages to all members and RSA for message encryption/decryption.
Before joining the chat room, the user generates a public key [e,n]
and private key [d,n]
. After generating the keys, the client Registers with the chat server by sending its public key which is broadcasted to all users.
Once the user has joined they can send unencrypted or encrypted messages. To send encrypted messages, they can click on a joined user's public key which will be filled into the encrypt field and write the message they want to encrypt in the send field. After clicking the encrypt button, their message will be encrypted and replace the plaintext in the send field.
Messages are filtered by each client. When a client receives a message with it's public key as the header, it will automatically decrypt the message and alert the user that a message was received.
- A recent version of node/npm (probably node 8+ should be fine)
- Nightly Rust (we use the latest and greatest)
git clone https://github.com/robertDurst/ChatDemo.git
cd ChatDemo
npm install
npm run build-debug // or npm run build-release
npm run client
npm run server
cargo test
The underlying crypto makes heavy use of the crates in rust-num, specifically num-bigint and num-trait crates.
The randomness for the crypto uses the rust rand crate.