Contents
Encryption Basics
End-to-end encryption (E2EE) is a communication system where only the communicating users can read the messages. In principle, it prevents potential eavesdroppers – including telecom providers, Internet providers, malicious actors, and even the provider of the communication service – from being able to access the cryptographic keys needed to decrypt the conversation.
Why End-to-End Encryption Matters
With traditional encryption, the service provider holds the keys and can access your messages. With end-to-end encryption, only the sender and recipient have the keys, keeping your conversations truly private.
Types of Encryption Keys
Asymmetric Keys (Public/Private)
Asymmetric encryption uses a pair of mathematically related keys: a public key that can be shared with anyone, and a private key that must be kept secret.
- Your public key is shared with others so they can encrypt messages for you
- Your private key never leaves your device and is used to decrypt messages
Symmetric Keys
Symmetric encryption uses the same key for both encryption and decryption. These are typically faster than asymmetric encryption.
- In our system, each chat room uses a symmetric key for message encryption
- This room key is securely shared with all participants using their public keys
How Our Encryption Works
Key Generation
When you first join Secure Chat, your browser automatically generates a unique public/private key pair using the Web Crypto API. Your private key never leaves your device.
Key Exchange
Your public key is shared with other users in your chat rooms. Each room also has its own symmetric key that's securely distributed to all participants.
Message Encryption
When you send a message, it's encrypted with the room's symmetric key before leaving your device. This encrypted data is what gets transmitted over the network and stored on our servers.
Message Decryption
When recipients receive the encrypted message, their devices use the room key to decrypt and display the message content. Without this key, the message remains unreadable.
Key Rotation
For enhanced security, encryption keys are automatically rotated periodically. New keys are securely distributed to all participants, ensuring continuous protection.
User A User B +------------------------+ +------------------------+ | Public Key A | | Public Key B | | Private Key A | | Private Key B | +------------------------+ +------------------------+ | | v v +------------------------+ +------------------------+ | Encrypt Room Key | WebSocket | Decrypt Room Key | | with User B's |------------------------>| with User B's | | Public Key | | Private Key | +------------------------+ +------------------------+ | | v v +------------------------+ +------------------------+ | Encrypt Message | WebSocket | Decrypt Message | | with Room Key |------------------------>| with Room Key | +------------------------+ +------------------------+
Key Management
Proper key management is essential for maintaining the security of your encrypted messages.
Key Storage
Your encryption keys are stored securely in your browser's localStorage. This means:
- Your keys are only available on the device and browser you're using
- If you clear your browser data, you'll lose access to your keys
- You need to export your keys if you want to use them on another device
Key Backup
We strongly recommend exporting and securely storing a backup of your keys:
- Click the "Manage Keys" button in any chat room
- Select "Export Keys" to download your key file
- Store this file in a secure location (password-protected storage)
Never share your exported keys with anyone. They contain your private key, which could be used to decrypt your messages.
Key Rotation
For enhanced security, our system automatically rotates keys:
- Your personal key pair is rotated every 30 days by default
- Room keys are rotated when your personal keys change
- You can manually trigger key rotation any time from the key management interface
Key rotation helps limit the impact of potential key compromise and is a security best practice.
Technical Details
Cryptographic Algorithms
Operation | Algorithm | Key Size | Purpose |
---|---|---|---|
Asymmetric Encryption | RSA-OAEP | 2048 bits | Securely exchanging room keys between users |
Symmetric Encryption | AES-GCM | 256 bits | Encrypting and decrypting messages |
Hashing | SHA-256 | N/A | Generating key fingerprints |
Implementation
Our encryption system is implemented entirely in JavaScript using the Web Crypto API, which provides:
- Cryptographically secure random number generation
- Hardware-accelerated cryptographic operations where available
- Standardized implementations of modern encryption algorithms
All encryption and decryption happens locally in your browser, ensuring that unencrypted data never leaves your device.
Key Exchange Protocol
Our key exchange protocol works as follows:
- When a user joins a room, they broadcast their public key to all existing members
- Existing members encrypt the room's symmetric key with the new user's public key
- The encrypted room key is sent to the new user over a WebSocket connection
- The new user decrypts the room key using their private key
- All subsequent messages use the room key for encryption/decryption
Security Considerations
Understanding Security Limitations
No security system is perfect. While our encryption provides strong protection for your messages, it's important to understand what it does and doesn't protect against.
What Encryption Protects Against
- Server administrators viewing your message content
- Network eavesdroppers intercepting your communications
- Database breaches exposing message content
- Other users who aren't members of your chat room
What Encryption Cannot Protect Against
- Malware or keyloggers on your device
- Someone with physical access to your unlocked device
- Screenshots or copies taken by chat recipients
- Compromise of your device's security
Metadata Considerations
While message content is encrypted, certain metadata is not:
- Who is chatting with whom
- When messages are sent
- Approximate message size
This metadata is necessary for the functioning of the chat system but could potentially reveal information about your communication patterns.
Frequently Asked Questions
Can server administrators read my messages?
No. With end-to-end encryption, your messages are encrypted on your device before being sent to the server. The server only sees encrypted data that it cannot decrypt.
What happens if I lose my encryption keys?
If you lose your keys (e.g., by clearing browser data without a backup), you won't be able to decrypt past messages. You'll generate new keys automatically, but previous encrypted messages will remain unreadable.
Can I use my account on multiple devices?
Yes, but you need to export your keys from one device and import them on the other. Without this step, each device will generate different keys and won't be able to decrypt the same messages.
Why do I see "Encrypted message - unable to decrypt" for some messages?
This happens when you don't have the correct room key to decrypt a message. This could occur if you joined a room after the message was sent and haven't received the room key, or if you're using a different device without your imported keys.
Is it possible to verify someone's identity through their encryption keys?
Yes. Each user's public key has a unique fingerprint displayed in the key management interface. For critical security, you can verify this fingerprint through another secure channel (e.g., in person or via phone) to confirm you're communicating with the right person.