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

Feature Request: Handle MegolmEvents, request keys from other sessions #47

Open
robertmx opened this issue Aug 9, 2021 · 3 comments
Open
Labels
enhancement New feature or request

Comments

@robertmx
Copy link

robertmx commented Aug 9, 2021

Dear Developers,
thank you for this nice command line utility. I have an encrypted 1on1 Chat that I would like to archive. Verification and room login has been successful. But the events received from the server are of the type "MegolmEvent", which is not handled. Any clues? I attached a sample of the event.

Message received for room XXX [XXXXX:matrix.org] | sender XXXXX [XXX] | 2021-08-06 21:28:22 | Received unknown event: MegolmEvent(source={'content': {'algorithm': 'm.megolm.v1.aes-sha2', 'ciphertext': 'AwgFEqAB8Nan2sc7IyEabZkXwKLUyz/tlrPxMwoTPHz4H8SLhuS0AD/K7DPhV1RpOJ5AgB2tobrW7CKH0trE5B7QMvp/6XcpKiSyKAWGTqsvl07rlHqGOqEPUf7PlSUtDZMvch3lYQaMHQBieSDT6+gNpJ2iiBlpdBxZlmavcCkzm8SXo3pDcL7JK9kt4GXkQLp7tWn6EJVQ2PkZnDa7MoMtfbYxd/Lo08OMXu+2Hnm83KE/xiaTyVw3cdgj3/UuGn+kUN0rWgCgCKhjID0IwMf9ldSQb1llQXc68B+Kd61l6cGtwuBkI53UpW2yCQ', 'device_id': 'LTUQENZNRX', 'sender_key': 'qxXN13jOmr4MlspZbmBqUB85FzyJuDt8m32HkLEefD0', 'session_id': 'mmsUFWpFsdxerIBDfNGhXlODh1Mhfo+TOPYyulJI3Sk'}, 'origin_server_ts': 1628278102151, 'room_id': '!rFTyESTNxkAoyZLznY:matrix.org', 'sender': 'XXXXXXX', 'type': 'm.room.encrypted', 'unsigned': {'age': 248567915}, 'event_id': '$fkJHAvQj3M_tKxZJRqvvY6kwfInGfkPwoF31E7kpcRM', 'user_id': 'XXXX', 'age': 248567915}, event_id='$fkJHAvQj3M_tKxZJRqvvY6kwfInGfkPwoF31E7kpcRM', sender='XXXXXX', server_timestamp=1628278102151, decrypted=False, verified=False, sender_key='qxXN13jOmr4MlspZbmBqUB85FzyJuDt8m32HkLEefD0', session_id='mmsUFWpFsdxerIBDfNGhXlODh1Mhfo+TOPYyulJI3Sk', transaction_id=None, device_id='LTUQENZNRX', ciphertext='AwgFEqAB8Nan2sc7IyEabZkXwKLUyz/tlrPxMwoTPHz4H8SLhuS0AD/K7DPhV1RpOJ5AgB2tobrW7CKH0trE5B7QMvp/6XcpKiSyKAWGTqsvl07rlHqGOqEPUf7PlSUtDZMvch3lYQaMHQBieSDT6+gNpJ2iiBlpdBxZlmavcCkzm8SXo3pDcL7JK9kt4GXkQLp7tWn6EJVQ2PkZnDa7MoMtfbYxd/Lo08OMXu+2Hnm83KE/xiaTyVw3cdgj3/UuGn+kUN0rWgCgCKhjID0IwMf9ldSQb1llQXc68B+Kd61l6cGtwuBkI53UpW2yCQ', algorithm='m.megolm.v1.aes-sha2', room_id='XXXX')

@robertmx
Copy link
Author

robertmx commented Aug 9, 2021

Well I dug around somewhat and I think I understand the problem here. The MegolmEvent from matrix-nio signals, that the session key is missing. I can see all messages that are sent, after matrix-commander joins the encrypted room, because its session key is added to the recipients list. Unfortunately it is impossible to archive old messages, because matrix-commander doesn't have the required session keys.
Normally that would be handled by requesting those keys from the other active sessions or retrieving them from the key backup, which seems not implemented in matrix-commander at the moment.

@8go
Copy link
Owner

8go commented May 18, 2022

A "late" thank you @robertmx for your comments. Yes, requesting keys from other sessions is not implicitly implemented in matrix-commander. If you have the skills and time, feel free to contribute a PR for this enhancement request.

@8go 8go changed the title MegolmEvent not handled Enhancement Request: Handle MegolmEvents, request keys from other sessions May 18, 2022
@8go 8go added the enhancement New feature or request label May 18, 2022
@8go 8go changed the title Enhancement Request: Handle MegolmEvents, request keys from other sessions Feature Request: Handle MegolmEvents, request keys from other sessions May 18, 2022
@solonovamax
Copy link

For anyone experiencing this issue, a temporary workaround is to export all your keys (in element: Settings -> Security & Privacy -> Cryptography -> Export E2EE room keys), and then import them using

matrix-commander --import-keys /path/to/the/keys 'the password' [the rest of your command]

this should allow you to decrypt all the past messages.

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

No branches or pull requests

3 participants