End-to-End Encryption (E2EE)
In Cypher, messages are encrypted on your device using the recipient’s public key, and can only be decrypted by the recipient’s corresponding private key. This ensures that only you and your conversation partners can view the contents of your messages.
Key Points
- Public and private key pairs are generated securely on your device.
- Your private key never leaves your device, ensuring confidentiality.
- Even Cypher’s own servers can’t read your messages.
Basic RSA Encryption Example
Below is a simple Node.js snippet illustrating RSA key generation, encryption, and decryption. You can adapt this logic for various programming languages and environments.
import crypto from 'crypto'; // Generate RSA key pair const { publicKey, privateKey } = crypto.generateKeyPairSync('rsa', { modulusLength: 2048, publicKeyEncoding: { type: 'pkcs1', format: 'pem', }, privateKeyEncoding: { type: 'pkcs1', format: 'pem', }, }); // Sample message const message = 'Hello from Cypher!'; // Encrypt with public key const encryptedData = crypto.publicEncrypt(publicKey, Buffer.from(message)); // Decrypt with private key const decryptedData = crypto.privateDecrypt(privateKey, encryptedData); console.log('Encrypted:', encryptedData.toString('base64')); console.log('Decrypted:', decryptedData.toString());
How Cypher Uses It
In a real Cypher conversation, the app automatically handles key generation, exchange, and message encryption under the hood. You simply chat normally, and the encryption ensures privacy at all times.