During the testing of omemo messages on my two android devices i.e. swordfish@atalk.org:811776503 (Note-8) and leopard@atalk.org:1288786947 (Note-3); I encountered problem that both devices locked up in a state that neither of them is able to send or receive omemo messages from each other. There is no exception being thrown by the omemo manager, so the messages appear to have been sent, however none of the sent/received messages are being displayed in the chat message windows on either of the devices. Short of performing a Omemo Identity Regeneration on the device, restarting aTalk app on both devices does not resolve the problems.
I have double checked and confirmed that both the omemo device id’s are correct and reflected in each other omemo active device list. They are also correctly embedded in the omemo messages sid and rid attributes.
hawk@atalk.org is an account installed on Conversation (Note-3). There is no problem in send/receive omemo messages between leopard and hawk. But the same problem happen when send/receive message is between swordfish and hawk. So look like the problem is on Note-8, some omemo data corruption on swordfish account.
Need some advice on the following:
- What can be the possible events that have led to devices locked up in this state?
- Why Omemo manager is unable to auto recover from this locked problem?
- What is the correct way to unlock and recover devices from this situation?
Note: After I performed an Omemo Identity Regeneration on Note-8, omemo message between swordfish and leopard return is now working. However my concern is user may not know the exact problem, as there is no UI error messages being shown when problem happen.
========================= locked state test result ===============================
When a omemo message is sent from swordfish, leopard has the following log messages:
========= leopard log ==============
08-12 13:28:39.257 23999-24144/org.atalk.android D/SMACK: RECV (0): <message xml:lang='en' to='leopard@atalk.org/atalk' from='swordfish@atalk.org/atalk' id='15340517182005717916'><encrypted xmlns='eu.siacs.conversations.axolotl'><header sid='811776503'><key prekey='true' rid='1288786947'>MwgGEiEF+xVRaNM2+IGNnG51hwWtYG35PLO0kzlKtTbpbtqxkgcaIQUh6wIw2lKKXgbt527LkbCo1lKAQATiEMKO09gixaHZRiJiMwohBeaYIBWa4y1FrB3u0xSMZYlfzYhckcBVgz7qiT2p0udsEAEYACIwVMZqWwJFh8Ya2Kwg+dC1qanGZwgFURVdHSrvQg8n6a4urwJo9I9pONOrjehFP3P6Nixy3HAzZzAoADAK</key><iv>CTo/7MQqsGhgMPf8kSERCQ==</iv></header><payload>TqsXehghRQ==</payload></encrypted><store xmlns='urn:xmpp:hints'/><encryption xmlns='urn:xmpp:eme:0' namespace='eu.siacs.conversations.axolotl' name='OMEMO'/><body>I sent you an OMEMO encrypted message but your client doesn't seem to support that. Find more information on https://conversations.im/omemo</body></message>
08-12 13:28:39.287 23999-24898/org.atalk.android W/aTalk: [28] org.jivesoftware.smackx.omemo.OmemoRatchet.retrieveMessageKeyAndAuthTag() Received message from swordfish@atalk.org:811776503 contained unknown identityKey. Ignore message.
Untrusted OMEMO Identity encountered:
Fingerprint of trusted key:
a2de9077 2e567407 ca55807b 84f05b70 ca6b0dae f1bf6bae b657bbc7 52d70428
Fingerprint of untrusted key:
21eb0230 da528a5e 06ede76e cb91b0a8 d6528040 04e210c2 8ed3d822 c5a1d946
at org.jivesoftware.smackx.omemo.signal.SignalOmemoRatchet.doubleRatchetDecrypt(SignalOmemoRatchet.java:97)
at org.jivesoftware.smackx.omemo.OmemoRatchet.retrieveMessageKeyAndAuthTag(OmemoRatchet.java:103)
at org.jivesoftware.smackx.omemo.OmemoService.decryptMessage(OmemoService.java:456)
at org.jivesoftware.smackx.omemo.OmemoService.onOmemoMessageStanzaReceived(OmemoService.java:1236)
at org.jivesoftware.smackx.omemo.OmemoManager$3$1.run(OmemoManager.java:990)
at java.lang.Thread.run(Thread.java:818)
08-12 13:28:39.297 23999-24898/org.atalk.android W/aTalk: [28] org.jivesoftware.smackx.omemo.OmemoService.onOmemoMessageStanzaReceived() Could not decrypt incoming message:
org.jivesoftware.smackx.omemo.exceptions.CryptoFailedException: Transported key could not be decrypted, since no suitable message key was provided. Provides keys: [1288786947]
at org.jivesoftware.smackx.omemo.OmemoRatchet.retrieveMessageKeyAndAuthTag(OmemoRatchet.java:123)
at org.jivesoftware.smackx.omemo.OmemoService.decryptMessage(OmemoService.java:456)
at org.jivesoftware.smackx.omemo.OmemoService.onOmemoMessageStanzaReceived(OmemoService.java:1236)
at org.jivesoftware.smackx.omemo.OmemoManager$3$1.run(OmemoManager.java:990)
at java.lang.Thread.run(Thread.java:818)
When the omemo is sent from leopard to swordfish, the log messages are shown below:
================ swordfish log on receive the omemo message from leopard ===============
08-12 13:29:32.855 15734-15837/org.atalk.android D/SMACK: RECV (0): <message xml:lang='en' to='swordfish@atalk.org/atalk' from='leopard@atalk.org/atalk' id='1534051773607957554845'><encrypted xmlns='eu.siacs.conversations.axolotl'><header sid='1288786947'><key rid='811776503'>MwohBWC/SgUDVUHQdHqgG8elCRnHO7rlq4BpG7gyriZgOgd6EBIYAyIwJrovTDoWnDuA7B/P3NdVYVV7EtUES8ssLrQ7ZzRLKiR3okamOCUIN5Aaf50TxBARbDOCqvoh9aI=</key><iv>2oQUrVPJ38VSok2pL83k8A==</iv></header><payload>jShNnqF75fwccQ==</payload></encrypted><store xmlns='urn:xmpp:hints'/><encryption xmlns='urn:xmpp:eme:0' namespace='eu.siacs.conversations.axolotl' name='OMEMO'/><body>I sent you an OMEMO encrypted message but your client doesn't seem to support that. Find more information on https://conversations.im/omemo</body></message>
08-12 13:29:33.411 15734-17108/org.atalk.android W/aTalk: [12249] org.jivesoftware.smackx.omemo.OmemoService.onOmemoMessageStanzaReceived() No raw session found for contact leopard@atalk.org:1288786947.
org.jivesoftware.smackx.omemo.exceptions.NoRawSessionException: org.whispersystems.libsignal.InvalidMessageException: No valid sessions.
at org.jivesoftware.smackx.omemo.signal.SignalOmemoRatchet.doubleRatchetDecrypt(SignalOmemoRatchet.java:128)
at org.jivesoftware.smackx.omemo.OmemoRatchet.retrieveMessageKeyAndAuthTag(OmemoRatchet.java:103)
at org.jivesoftware.smackx.omemo.OmemoService.decryptMessage(OmemoService.java:456)
at org.jivesoftware.smackx.omemo.OmemoService.onOmemoMessageStanzaReceived(OmemoService.java:1236)
at org.jivesoftware.smackx.omemo.OmemoManager$3$1.run(OmemoManager.java:990)
at java.lang.Thread.run(Thread.java:764)
Caused by: org.whispersystems.libsignal.InvalidMessageException: No valid sessions.
at org.whispersystems.libsignal.SessionCipher.decrypt(SessionCipher.java:290)
at org.whispersystems.libsignal.SessionCipher.decrypt(SessionCipher.java:243)
at org.whispersystems.libsignal.SessionCipher.decrypt(SessionCipher.java:211)
at org.jivesoftware.smackx.omemo.signal.SignalOmemoRatchet.doubleRatchetDecrypt(SignalOmemoRatchet.java:122)
at org.jivesoftware.smackx.omemo.OmemoRatchet.retrieveMessageKeyAndAuthTag(OmemoRatchet.java:103)
at org.jivesoftware.smackx.omemo.OmemoService.decryptMessage(OmemoService.java:456)
at org.jivesoftware.smackx.omemo.OmemoService.onOmemoMessageStanzaReceived(OmemoService.java:1236)
at org.jivesoftware.smackx.omemo.OmemoManager$3$1.run(OmemoManager.java:990)
at java.lang.Thread.run(Thread.java:764)
Caused by: org.whispersystems.libsignal.InvalidMessageException: Bad Mac!
at org.whispersystems.libsignal.protocol.SignalMessage.verifyMac(SignalMessage.java:119)
at org.whispersystems.libsignal.SessionCipher.decrypt(SessionCipher.java:313)
at org.whispersystems.libsignal.SessionCipher.decrypt(SessionCipher.java:268)
at org.whispersystems.libsignal.SessionCipher.decrypt(SessionCipher.java:243)
at org.whispersystems.libsignal.SessionCipher.decrypt(SessionCipher.java:211)
at org.jivesoftware.smackx.omemo.signal.SignalOmemoRatchet.doubleRatchetDecrypt(SignalOmemoRatchet.java:122)
at org.jivesoftware.smackx.omemo.OmemoRatchet.retrieveMessageKeyAndAuthTag(OmemoRatchet.java:103)
at org.jivesoftware.smackx.omemo.OmemoService.decryptMessage(OmemoService.java:456)
at org.jivesoftware.smackx.omemo.OmemoService.onOmemoMessageStanzaReceived(OmemoService.java:1236)
at org.jivesoftware.smackx.omemo.OmemoManager$3$1.run(OmemoManager.java:990)
at java.lang.Thread.run(Thread.java:764)
[12249] org.jivesoftware.smackx.omemo.OmemoService.repairBrokenSessionWithPreKeyMessage() Attempt to repair the session by sending a fresh preKey message to leopard@atalk.org:1288786947
08-12 13:29:33.413 15734-15836/org.atalk.android D/SMACK: SENT (0): <iq to='leopard@atalk.org' id='zC0kv-144' type='get'><pubsub xmlns='http://jabber.org/protocol/pubsub'><items node='eu.siacs.conversations.axolotl.bundles:1288786947'/></pubsub></iq>
08-12 13:29:33.444 15734-15837/org.atalk.android D/SMACK: RECV (0): <iq xml:lang='en' to='swordfish@atalk.org/atalk' from='leopard@atalk.org' type='result' id='zC0kv-144'><pubsub xmlns='http://jabber.org/protocol/pubsub'><items node='eu.siacs.conversations.axolotl.bundles:1288786947'><item id='5FEC7A6A2143'><bundle xmlns='eu.siacs.conversations.axolotl'><signedPreKeyPublic signedPreKeyId='10'>BTM9uzIbwA5dLiKQQXkgy+5Y5slZF4u3+ZLICzcyrY5w</signedPreKeyPublic><signedPreKeySignature>Marzy7ChmMmlEUPTOoNrwZvdRELsDeI/O9WyDZwvpSJ+AB8QAAuteI9PuDwAO1W0ldO8DLroeCuSDPadiT42ig==</signedPreKeySignature><identityKey>BaeJVdbYWk0VEMjsRcSIAjx+P2SUQ7uZFgBOeSxbXUIQ</identityKey><prekeys><preKeyPublic preKeyId='37'>BQ8Cw5qNEgrWiYIGsIDdVzsN66XO262X//YQ3RvcXT1M</preKeyPublic><preKeyPublic preKeyId='71'>BSQL7iWqKvbfAABRSApB0aPeLNomEbz65564y+lzixlG</preKeyPublic>
...
preKeyId='100'>BTVbXW1tbiPOElifycVVrAoRaLVLatf5xr3SdQ7b640c</preKeyPublic><preKeyPublic preKeyId='74'>BeQQnrK7Yln+CbdVdx/0s2296rpAsC1cxEGccbT7Ns5b</preKeyPublic><preKeyPublic preKeyId='10'>BUR43oQiDT13ZJF8XNunL+LJZ0L6kXQJUuGVY37OJ/5b</preKeyPublic></prekeys></bundle></item></items></pubsub></iq>
08-12 13:29:33.452 15734-15837/org.atalk.android D/SMACK: RECV (0): <r xmlns='urn:xmpp:sm:3'/>
08-12 13:29:33.453 15734-15836/org.atalk.android D/SMACK: SENT (0): <a xmlns='urn:xmpp:sm:3' h='47'/>
08-12 13:29:33.609 15734-17108/org.atalk.android I/aTalk: [12249] org.atalk.crypto.omemo.SQLiteOmemoStore.storeOmemoIdentityKey().472 Update identityKey for: leopard@atalk.org:1288786947
08-12 13:29:33.651 15734-17108/org.atalk.android I/aTalk: [12249] org.atalk.crypto.omemo.SQLiteOmemoStore.storeOmemoIdentityKey().472 Update identityKey for: leopard@atalk.org:1288786947
08-12 13:29:33.682 15734-15836/org.atalk.android D/SMACK: SENT (0): <message to='leopard@atalk.org' id='zC0kv-146'><encrypted xmlns='eu.siacs.conversations.axolotl'><header sid='811776503'><key prekey='true' rid='1288786947'>MwgtEiEFfbdjJ6DDbo7M3b1BiEdtSITp+skDEbfdrzyI3dSkKSQaIQUh6wIw2lKKXgbt527LkbCo1lKAQATiEMKO09gixaHZRiJSMwohBfrucJO2pR1CJY38MugifM6q4edkKRah/ZfCQmX3TxkAEAAYACIg2LQ8LJXSCjTD7lvW1tMInr8a0uprZuX/6ql+U4vsIs9HbCKB5pL6bSgAMAo=</key><iv>tozLoi8ACIU/v+42BJouCw==</iv></header></encrypted></message><r xmlns='urn:xmpp:sm:3'/>
============= leopard log after omemo message is sent ================
08-12 13:29:34.657 23999-24144/org.atalk.android D/SMACK: RECV (0): <message xml:lang='en' to='leopard@atalk.org/atalk' from='swordfish@atalk.org/atalk' id='zC0kv-146'><encrypted xmlns='eu.siacs.conversations.axolotl'><header sid='811776503'><key prekey='true' rid='1288786947'>MwgtEiEFfbdjJ6DDbo7M3b1BiEdtSITp+skDEbfdrzyI3dSkKSQaIQUh6wIw2lKKXgbt527LkbCo1lKAQATiEMKO09gixaHZRiJSMwohBfrucJO2pR1CJY38MugifM6q4edkKRah/ZfCQmX3TxkAEAAYACIg2LQ8LJXSCjTD7lvW1tMInr8a0uprZuX/6ql+U4vsIs9HbCKB5pL6bSgAMAo=</key><iv>tozLoi8ACIU/v+42BJouCw==</iv></header></encrypted></message>
08-12 13:29:34.687 23999-25049/org.atalk.android W/aTalk: [29] org.jivesoftware.smackx.omemo.OmemoRatchet.retrieveMessageKeyAndAuthTag() Received message from swordfish@atalk.org:811776503 contained unknown identityKey. Ignore message.
Untrusted OMEMO Identity encountered:
Fingerprint of trusted key:
a2de9077 2e567407 ca55807b 84f05b70 ca6b0dae f1bf6bae b657bbc7 52d70428
Fingerprint of untrusted key:
21eb0230 da528a5e 06ede76e cb91b0a8 d6528040 04e210c2 8ed3d822 c5a1d946
at org.jivesoftware.smackx.omemo.signal.SignalOmemoRatchet.doubleRatchetDecrypt(SignalOmemoRatchet.java:97)
at org.jivesoftware.smackx.omemo.OmemoRatchet.retrieveMessageKeyAndAuthTag(OmemoRatchet.java:103)
at org.jivesoftware.smackx.omemo.OmemoService.decryptMessage(OmemoService.java:456)
at org.jivesoftware.smackx.omemo.OmemoService.onOmemoMessageStanzaReceived(OmemoService.java:1236)
at org.jivesoftware.smackx.omemo.OmemoManager$3$1.run(OmemoManager.java:990)
at java.lang.Thread.run(Thread.java:818)
[29] org.jivesoftware.smackx.omemo.OmemoService.onOmemoMessageStanzaReceived() Could not decrypt incoming message:
org.jivesoftware.smackx.omemo.exceptions.CryptoFailedException: Transported key could not be decrypted, since no suitable message key was provided. Provides keys: [1288786947]
at org.jivesoftware.smackx.omemo.OmemoRatchet.retrieveMessageKeyAndAuthTag(OmemoRatchet.java:123)
at org.jivesoftware.smackx.omemo.OmemoService.decryptMessage(OmemoService.java:456)
at org.jivesoftware.smackx.omemo.OmemoService.onOmemoMessageStanzaReceived(OmemoService.java:1236)
at org.jivesoftware.smackx.omemo.OmemoManager$3$1.run(OmemoManager.java:990)
at java.lang.Thread.run(Thread.java:818)