This project implements an end-to-end encrypted chat system using the Double Ratchet Algorithm, designed to meet additional requirements for government surveillance. It offers essential features such as certificate generation, secure key exchange, and encrypted messaging, ensuring Forward Secrecy and Break-in Recovery.
- End-to-End Encryption using the Double Ratchet Algorithm.
- ElGamal Key Pairs for secure initial key exchange.
- AES-GCM for symmetric encryption of messages.
- Forward Secrecy to safeguard past communications even if current keys are compromised.
- Government Key Encryption for encrypting session keys with government-issued public keys.
- Certificate-based Identity Verification for enhanced security and trust.
- Node.js (version 18 or above)
- NPM (Node Package Manager)
-
Clone the repository:
git clone <repository-url> cd encrypted-chat-client
-
Install dependencies:
npm install
-
Run tests to verify functionality:
npm test
Interact with the Messenger system via the command-line interface (CLI).
-
Start the CLI:
node cli.js
-
Available commands:
-
Generate a certificate for the user:
generate <username>
-
Receive and verify a certificate:
receive <name> <key> <sig>
-
Send an encrypted message:
send <name> <message>
-
Receive and decrypt a message:
receive-message <name>
-
Exit the CLI:
exit
-
> generate alice
Generated Certificate: { username: 'alice', publicKey: '...' }
> send bob "Hello, Bob!"
Encrypted Message Sent: { header: { iv: '...', authTag: '...' }, ciphertext: '...' }
> receive-message alice
Decrypted Message: Hello, Bob!
To ensure proper functionality, run the following command:
npm testThis executes the test cases in test-messenger.js to verify all features are working correctly.
- messenger.js: Core implementation of the Messenger class.
- lib.js: Cryptographic utilities (e.g., key generation, encryption, HKDF).
- test-messenger.js: Unit tests to verify Messenger functionality.
- cli.js: Command-line interface for interacting with the Messenger system.
- Node.js: Server-side JavaScript runtime.
- Crypto: Native Node.js cryptographic library for encryption and key management.
- Chai: Assertion library for unit testing.
- Double Ratchet Algorithm: Securely updates encryption keys with each message, ensuring forward secrecy.
- Government Surveillance: Encrypts session keys using a government-issued public key for compliance.
- Certificate Verification: Ensures authenticity of communication via trusted certificate authority.
- AES-GCM Encryption: Provides confidentiality and ensures message integrity with built-in authentication.
- Add support for handling out-of-order messages.
- Develop a web-based user interface for easier interaction.
- Extend functionality to simulate multiple clients for testing.
This project is licensed under the MIT License. See the LICENSE file for more details.