I am building a system where the clients should be able to communicate with each other. However I want all the data to be hidden from the server where the information is stored in a database.

How can the users invite more users and share the encryption key without that the server also get the key?

  1. First user creates a key (locally on the device) to encrypt the messages (symmetric encryption).
  2. First user invites another user. How can the key be distributed from the first user to the second user without that the server also get this information? Same question goes for user three etc.
  3. The idea is that the second user, after accepting invite, can read all the data that the first user have created and that now user two and three can create new data that user one can read.
  4. I don't want the users having to enter passwords or such things.
  5. The clients cannot communicate directly with each other, it has to go through the server.

I suppose that when the key has been distributed it's quite easy to just store that on the clients and then the key can be used to both decrypt and encrypt the messages. If a client loses the key I suppose that that user needs a new invite to be able to read the data again. For this system it is not required that the key needs to be changed if someone leaves the group.

  • 2
    What do you need more than the Signal Protocol? – kelalaka Jan 23 at 21:43
  • 1
    That, and why do you want to use symmetric encryption? – multithr3at3d Jan 23 at 22:03

Matrix.org have an implementation of the double ratchet algorithm used by signal for end to end encryption and they have an implementation for groups as well. It is available as a free library (Apache license) on their site with bindings for JavaScript, Python, Java (Android), and Objective-C as well as some others provided by third parties.


  • Signal protocol >= The protocol combines the Double Ratchet algorithm, prekeys, and a triple Elliptic-curve Diffie–Hellman (3-DH) handshake,[5] and uses Curve25519, AES-256, and HMAC-SHA256 as primitives. – kelalaka Jan 23 at 22:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.