-
Notifications
You must be signed in to change notification settings - Fork 16
Encrypted history sharing: design to-device message format #2689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
(We considered incorporating some security improvements to fix issues highlighted in Lotte's blog post. However, those attacks seem even harder to exploit in this application than in regular encrypted media, so that remains TBD) |
As a first pass on this, I think all we really need is a to-device message with a property of type I don't think we need the room ID -- that is part of the bundle, and omitting it leaves future flexibility in bundling keys for multiple rooms. However, I'd like to take the opportunity to simplify the So, example message: {
"type": "m.room_key_bundle", // or "io.element.msc4268.room_key_bundle" while unstable
"content": {
"file": {
"v": "v3",
"url": "mxc://example.org/FHyPlCeYUSFFxlgbQYZmoEoe",
"key": "aWF6-32KGYaC3A_FEUCk1Bt0JA37zP0wrStgmdCaW-0",
"iv": "w+sE15fzSc0AAAAAAAAAAA",
"hash": "fdSLu/YkRx3Wyh3KQabP3rd6+SFiKg5lsJZQHtkSAYA"
}
}
} As with encrypted media, the sender:
Properties of the
Obviously, any messages not matching any of the above requirements should be ignored. |
I thought about this briefly (because I missed that this was a separate issue from #2688). I was wondering if we should be leaning into extensible events (matrix-org/matrix-spec-proposals#3551) -- the main difference from your proposed format being that we use I was also wondering if we wanted to change the encryption from AES to ChaCha20-Poly1305, which is now being used in dehydrated devices and (IIRC) QR code login. My initial thought was to hold off until we do a general update on encrypted media, but if you're proposing to bump the encrypted attachment version, then we may want to consider changing the encryption algorithm as well. (This would also allow us to drop the hash, since it's already authenticated. Also get rid of the "bottom 64 bits must be zero" requirement.) With respect to the |
I guess we could. I feel like this message shouldn't be extensible, though -- if the receiving client doesn't understand it, it shouldn't be doing anything else with it, least of all trying to display it as a text file (as you might, given
Yeah, we should. Good idea. I think that would still mean that
I mean not url-safe, for consistency with almost all our other base64 properties; unlike the |
I wasn't intending that the message should be extensible. But the format seems like it kind of fits into the extensible events paradigm, in that it's an event of one type, using a format defined by a different type. On the other hand, I'm not sure how much extensible events (and the |
On further consideration: redesigning encrypted attachments is a bigger job, and fairly clearly out of scope here. I've opened matrix-org/matrix-spec#2087 to track it. For now then, let's just use the existing encrypted-attachment format for these messages: {
"type": "m.room_key_bundle", // or "io.element.msc4268.room_key_bundle" while unstable
"content": {
"file": {
"v": "v2",
"url": "mxc://example.org/FHyPlCeYUSFFxlgbQYZmoEoe",
"key": {
"alg": "A256CTR",
"ext": true,
"k": "aWF6-32KGYaC3A_FEUCk1Bt0JA37zP0wrStgmdCaW-0",
"key_ops": ["encrypt","decrypt"],
"kty": "oct"
},
"iv": "w+sE15fzSc0AAAAAAAAAAA",
"hashes": {
"sha256": "fdSLu/YkRx3Wyh3KQabP3rd6+SFiKg5lsJZQHtkSAYA"
}
}
}
} |
We will also need to include the |
Our proposed solution to sharing encrypted room history on invite involves sharing the keys to an encrypted blob via to-device messages.
This issue tracks the creation of a format for those to-device messages. Likely they will be based on the encrypted attachment format.
Conclusion
2025-04-11: for reference, the current design for this is:
The text was updated successfully, but these errors were encountered: