Skip to content
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

Megolm Session Key differs between m.room_key and m.forwarded_room_key #3725

Open
patrick-scho opened this issue Sep 13, 2023 · 1 comment
Open

Comments

@patrick-scho
Copy link

Hello, I hope this is the right place to ask this question.
I am building a Matrix client library and I'm trying to decrypt group messages.
Currently I am testing this using the Element web client, but as far as I could tell they use this library.
I am using the C libolm, hopefully you can still help me.
When I receive a new message, an m.room_key event is sent, and I can create my OlmInboundGroupSession and decrypt the message.
But when I try to decrypt a past message and send an m.room_key_request, I get an m.forwarded_room_key event, and the session key is different from the one I initially got.
I noticed that the key has a length of SESSION_EXPORT_RAW_LENGTH instead of SESSION_KEY_RAW_LENGTH, so I tried using olm_import_inbound_group_session instead of olm_init_inbound_group_session, which seems to successfully initialize the session, but then I am not able to decrypt the message and I get a BAD_SIGNATURE error.
I tried looking at how room key events are handled in this library, but it looks like m.room_key and m.forwarded_room_key are handled the same way, which is what I wanted to do as well.
I'm guessing this is some stupid oversight on my part, but I couldn't figure it out, so I'm hoping someone can help me out.

@EnglanM
Copy link

EnglanM commented Feb 14, 2024

@patrick-scho did you solve this issue bro?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants