Keystore per conversation #171
Labels
enhancement
New feature or request
improvement
Improve on existing feature
P-Normal
Normal Priority
refactoring
Major change to features
While direct messaging works fine as is, group messaging does not scale all as it was expected to be. This is primarily due to how a single message is encrypted per recipient in a conversation, which while for 3 to 5 recipients may be fine, large numbers of members (eg 10+ to 50+) may not scale well, which would increase cpu processing time, memory usage as well as an increase in network usage due to how large the payload would be. A proposal here would be to go back to the original idea from several months where a conversation would have its own keystore which would store the keys of recipients generated for that conversation.
Thought Process (Simplified):
Concept A - Unique User Key Per Conversation (Group Chat, Key Push)
Summary
Each user would supply a unique private key to the conversation that would allow another user who is decrypt their messages. Keys supplied are automatically pushed out to each user upon being apart of the conversation or any changes in the recipient list, if there is an implementation to change keys around.
Conversation Creation
A
creates a conversation forB
,C
, andD
.A
generates a private key and stores it into a keystore assigned with the conversation idB
,C
, andD
, withA
generated private key, along with the list of recipients.B
,C
,D
will see the newly creation conversation withA
private key. It stores it into a keystore encrypted with their own private key, assigned with the conversation id and will generate a key, which is stored into the same keystore for the conversation as well as transmitting their key toA
as well as to each other.Sending a Message
A
sends a message through RayGun::send_messageA
and encrypts message with key.Receiving a Message
A
.A
key from the keystore and decrypts it and validate the message.Adding Recipient
A
adds recipientE
, transmitting the list of recipients as well as private key from keystore, notifying current recipients ofE
E
may also receive keystore fromA
for all available recipients.E
receives event, saving the recipients as well asA
private key for the conversation, and sending its generated key to toA
and all recipients.E
Removing Recipient
A
removes recipientB
, notifying current recipients ofB
removal.B
receives event, destroying the conversation as well as the keys stored apart of the conversation.B
, markingB
key asstale
Concept B - Unique User Key Per Conversation (Group Chat, Request)
Summary
Each user would supply a unique private key to the conversation that would allow another user who is decrypt their messages. Private keys are requested upon creation of the conversation, being encrypted with a shared key between the requester and requestee, assuming they are apart of the recipient list. If a key for the message does not exist, the user can request the key for the message to be supplied.
Conversation Creation
A
creates a conversation forB
,C
, andD
.A
generates a private key and stores it into a keystore assigned with the conversation idB
,C
, andD
with the list of recipients.B
,C
,D
will see the newly creation conversation, generates a key and stores it into a keystore encrypted with their own private key, assigned with the conversation id.A
,B
.C
. D`. will send a request for their unique private key, which is sent to each other encrypted by each other keypair via EDCH.C
sends a request toD
,D
will verify thatC
is apart of the conversation by validating it with the recipient list. Once confirmed,D
will generate a key withC
public key, which is used to encryptD
private key for the conversation and transmit it over toC
, withC
storing it into its keystore assigned with the conversation id.A
, which would validate the authenticity of the conversation properties.Sending a Message
Receiving a Message
A
.A
key from the keystore and decrypts it and validate the message.A
key is not in the recipient keystore for the conversation for whatever reason, the recipient can requestA
key for the conversation (SeeConcept B, Conversation Creation
for requesting). If key could not be fetched, it would be ignored for the time being.Adding Recipient
A
adds recipientE
, transmitting the list of recipients, notifying current recipients ofE
.E
receives event, saving the recipients as well asA
private key for the conversation, and sending its generated key to toA
and all recipients.E
, whileE
request the private keys from the recipients.Removing Recipient
A
removes recipientB
, notifying current recipients ofB
removal.B
receives event, destroying the conversation as well as the keys stored apart of the conversation.B
, markingB
key asstale
stale
, making it so it could not be used for newer messages but can be used for decrypting older messagesConcept C - Unique Key Per Conversation (Group Chat)
Summary
A group conversation that is created would contain a single private key that would be used to encrypt/decrypt messages send to the group. This key would be created by the creator of the group, and may be changed out at any time by the creator of the group.
Conversation Creation
A
creates a conversation forB
,C
, andD
.A
generates a private key and assign it to the conversation while storing it into a keystore assigned with the conversation id.A
generated private key, along with the list of recipients.Sending a Message
Receiving a Message
Adding a Recipient
A
adds recipientE
, transmitting the list of recipients as well as private key from keystore for the conversation, notifying current recipients ofE
E
receives event, saving the recipients as well asA
private key for the conversation.Removing Recipient
A
removes recipientB
, transmitting the list of recipients, notifying current recipients ofB
removal.B
receives event, destroying the conversation as well as the keys stored apart of the conversation.B
A
will generate a new group key, marking the old one as stale so newer messages will be encrypted with the newer key with older messages only being able to be decrypted with the old key.Notes:
The text was updated successfully, but these errors were encountered: