Cannot read encrypted message sent by kazv
tusooa opened this issue · 1 comments
Co-stream: https://lily-is.land/kazv/kazv/-/issues/57
Steps to reproduce
- Have only Element Android running for account A (stop all other clients)
- Send an encrypted message from account B in kazv (https://lily-is.land/kazv/kazv)
Outcome
What did you expect?
Element Android should be able to decrypt the message
What happened instead?
Element Android is not able to decrypt the message. If other clients are running, the key might be forwarded to Element Android, but a grey shield will be displayed, indicating "the authenticity of this message cannot be guaranteed on this device."
Your phone model
No response
Operating system version
No response
Application version and app store
No response
Homeserver
No response
Will you send logs?
Yes
Are you willing to provide a PR?
No
I think I have found out the root cause of this problem.
the format of an Olm-encrypted event is a map from the recipient's key to a string (cipher text)
element android only checks the first item in the map, and check if it contains the current device's key. if it doesn't, it just fails.
but kazv sends the same thing to every device. the event contains every cipher text for every device
like {"key1": "ciphertext1", "key2": "ciphertext2"}
element android only checks the first item in the map, i.e. key1
suppose element android's pubkey is actually key2, then key2 will be completely ignored
element should instead check for its own public key in the map, and use that mapped value.