--- author: Joep Demollin tags: Encryption --- # Concept Encryption We want to implement end-to-end encryption, hereafter referred to as **E2EE**. This should be possible in: - [x] [Private one-to-one chats](#1-One-to-one-Channels) - [ ] Public channels - [x] [Private multi-user/group channels](#2-Group-Channels) In designing this there are several properties we might search in a algoritm we use. There are several, but 3 we will always mention with every option will be: - End-to-end encrypted (Necessary) - Forward security (highly valued) - Post-crompromise security (highly valued) ## 0. Explaining concepts When deciding what our strategy will be, these will be the concepts we need to know about. ### Types of chats #### One-to-one Channels These are standard channels between two people. Most E2EE-standards are built for this scenario. A user should be able to send a message via the server without the server knowing what the message says. In our application it should also be possible to encrypt the keystroke data with it. Things we need to look out for are: - Sharing public key via server? - Users with multiple devices? - Real life confirmation? #### Multi-user channels These are channels in which multiple people can send and receive messages. This is harder to achieve because we might run in to complexity struggles. Things we need to look out for are: - [ ] Do we want new users joining a channel to be able to read previous messages? - Users that left the channel or were kicked can not still read future messages? - Complexity is not out of control? - Users with multiple devices? --- ### Properties #### End-to-end encryption #### Forward-secrecy #### Post-compromise security ## 1. Options for implementation ### Pure RSA Uses the product of two large primes. ![](https://i.imgur.com/nOYsslU.png) ### Signal protocol https://github.com/privacyresearchgroup/libsignal-protocol-typescript Signal has a very strong implementation for E2EE, and uses a modified version for group chats. The group implementation is not significantly different from the person-to-person version. A group message is just a private message send to a lot of different people. Seen as our users have different messages for people with whom we share keystroke date and those with whom we don't, it might be a good way to implement it for us. ## 2. Group Channels ### Asynchronous Ratcheting Trees (ART) ### RSA en ESA combined We could use RSA to safely communicate the ESA key between parties, after which ESA will offer a safe and much faster way of securing data. https://tsf.telegram.org/manuals/e2ee-simple#multi-device-end-to-end-encrypted-chats-are-a-mess https://support.signal.org/hc/en-us/articles/360007060632-What-is-a-safety-number-and-why-do-I-see-that-it-changed-