Current aTalk “Regenerate OMEMO identities” implementations are shown below. The debug log captured the whole process flow when one perform this operation; replacing…
old: peacock@atalk.sytes.net:648420352
new: peacock@atalk.sytes.net:1966536913
* Regenerate new omemo identity for the device
* 1. Purge server bundle data and items for the old omemoDevice
* 2. Purge account Omemo info in the local database
* 3. Call via AndroidOmemoService() to:...
The process flow consists of 3 parts as shown above
-
Purge server bundle data and items for the old omemoDevice
aTalk attempts to clean up the server bundle info for the old omemoDevice i.e. peacock@atalk.sytes.net:648420352 -
Purge account Omemo info in the local database
All the relevant table parameters for the old device are removed i.e. omemo_device, prekeys, signed_prekeys and associated identities. -
Call via AndroidOmemoService() to:…
Via smack-omemo, to create a new deviceid and publish to the server
From the debug log, all the above 3 steps are completed successfully without problem.
However the problem is when smack-omemo requests for the devicelist from the server, the old
peacock@atalk.sytes.net:648420352 is returned. This old and new is merged in smack-omemo and published to the servers.
This causes problem when omemo messages is sent/received. See debug log on
“=========== sending omemo message between peacock to swordfish ==========”
Any idea why the server still return an deleted omemoDevice?
Any advice on how to resolve the problem is appreciated.
2021-01-23 08:07:43.363 12826-13551/org.atalk.android D/SMACK: SENT (0):
<iq id='ZTN97-46' type='get'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<items node='eu.siacs.conversations.axolotl.devicelist'/>
</pubsub>
</iq>
<a xmlns='urn:xmpp:sm:3' h='77'/>
2021-01-23 08:07:43.380 12826-13552/org.atalk.android D/SMACK: RECV (0):
<iq xml:lang='en-GB' to='peacock@atalk.sytes.net/atalk' from='peacock@atalk.sytes.net' type='result' id='ZTN97-46'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<items node='eu.siacs.conversations.axolotl.devicelist'>
<item id='64B57EEA619D0'>
<list xmlns='eu.siacs.conversations.axolotl'>
<device id='648420352'/>
</list>
</item>
</items>
</pubsub>
</iq>
================== aTalk Regenerate Implementation ===============
/**
* Regenerate new omemo identity for the device
* 1. Purge server bundle data and items for the old omemoDevice
* 2. Purge account Omemo info in the local database
* 3. Call via AndroidOmemoService() to:
* a. create new Omemo deviceId
* b. generate fresh user identityKeyPairs, bundle
* c. publish it to the server.
*/
public void regenerate(AccountID accountId)
{
ProtocolProviderService pps = accountId.getProtocolProvider();
if (pps != null) {
XMPPConnection connection = pps.getConnection();
if ((connection != null) && connection.isAuthenticated()) {
// Purge all omemo devices info in database and server for the specified account
purgeUserOmemoData(accountId);
new AndroidOmemoService(pps).initOmemoDevice();
}
}
}
/**
* Clean up omemo database and omemo bundle data on the server for user account when deleted.
*
* @param accountId the omemo local database/server of the accountID to be purged.
*/
public void purgeUserOmemoData(AccountID accountId)
{
// Purge server omemo bundle nodes for the deleted account (only if online and registered)
ProtocolProviderService pps = accountId.getProtocolProvider();
if (pps != null) {
XMPPConnection connection = pps.getConnection();
if ((connection != null) && connection.isAuthenticated()) {
BareJid userJid = accountId.getBareJid();
PubSubManager pubsubManager = PubSubManager.getInstanceFor(connection, userJid);
OmemoCachedDeviceList deviceList = mDB.loadCachedDeviceList(userJid);
for (int deviceId : deviceList.getAllDevices()) {
try {
OmemoDevice omemoDevice = new OmemoDevice(userJid, deviceId);
Timber.d("Purge server bundle for omemo device: %s", omemoDevice);
String nodeId = omemoDevice.getBundleNodeName();
LeafNode leafNode = pubsubManager.getLeafNode(nodeId);
leafNode.deleteAllItems();
pubsubManager.deleteNode(nodeId);
} catch (SmackException | InterruptedException | XMPPException.XMPPErrorException e) {
aTalkApp.showToastMessage(R.string.omemo_purge_inactive_device_error, userJid);
}
}
}
}
// Purge local omemo database for the specified account
mDB.purgeOmemoDb(accountId);
trustCache.evictAll();
}
================ aTalk Regeneration process flow ===============
2021-01-23 08:06:47.891 12826-14889/org.atalk.android D/(OmemoRegenerateDialog.java:91)#run: Regenerate Omemo for: peacock@atalk.sytes.net
2021-01-23 08:06:47.899 12826-14889/org.atalk.android D/(SQLiteOmemoStore.java:809)#purgeUserOmemoData: Purge server bundle for omemo device: peacock@atalk.sytes.net:648420352
2021-01-23 08:06:47.907 12826-13551/org.atalk.android D/SMACK: SENT (0):
<iq id='ZTN97-40' type='set'>
<pubsub xmlns='http://jabber.org/protocol/pubsub#owner'>
<purge node='eu.siacs.conversations.axolotl.bundles:648420352'/>
</pubsub>
</iq>
2021-01-23 08:06:47.938 12826-13552/org.atalk.android D/SMACK: RECV (0):
<iq xml:lang='en-GB' to='peacock@atalk.sytes.net/atalk' from='peacock@atalk.sytes.net' type='result' id='ZTN97-40'/>
2021-01-23 08:06:47.954 12826-13551/org.atalk.android D/SMACK: SENT (0):
<iq id='ZTN97-42' type='set'>
<pubsub xmlns='http://jabber.org/protocol/pubsub#owner'>
<delete node='eu.siacs.conversations.axolotl.bundles:648420352'/>
</pubsub>
</iq>
2021-01-23 08:06:47.981 12826-13552/org.atalk.android D/SMACK: RECV (0):
<iq xml:lang='en-GB' to='peacock@atalk.sytes.net/atalk' from='peacock@atalk.sytes.net' type='result' id='ZTN97-42'/>
2021-01-23 08:06:47.987 12826-14889/org.atalk.android D/(DatabaseBackend.java:1337)#purgeOmemoDb: >>> Wiping OMEMO database for account : peacock@atalk.sytes.net
2021-01-23 08:06:48.063 12826-14889/org.atalk.android I/(DatabaseBackend.java:499)#storeOmemoRegId: ### Omemo device added for: peacock@atalk.sytes.net; 1966536913
2021-01-23 08:06:48.067 12826-14889/org.atalk.android I/(AndroidOmemoService.java:50)#<init>: ### Registered omemo messageListener for: peacock@atalk.sytes.net
2021-01-23 08:06:48.702 12826-14892/org.atalk.android I/(SQLiteOmemoStore.java:383)#storeOmemoIdentityKeyPair: Store omemo identityKeyPair for :peacock@atalk.sytes.net:1966536913
2021-01-23 08:07:43.201 12826-13551/org.atalk.android D/SMACK: SENT (0):
<iq id='ZTN97-44' type='set'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<publish node='eu.siacs.conversations.axolotl.bundles:1966536913'>
<item>
<bundle xmlns='eu.siacs.conversations.axolotl'>
<signedPreKeyPublic signedPreKeyId='1'>
BSLyWws2FkR10UoDLmnWFf5C63YTC3eFuBaRgqeIffkA
</signedPreKeyPublic>
<signedPreKeySignature>
zGyTbE02UHrOW2M1ga4szdsETi7nIPp6K7G9FC5acWUQGt+JLQyG23UC4EYB5qf5j75WX931YkpaVIfj1bhIBA==
</signedPreKeySignature>
<preKeyPublic preKeyId='100'>
BeVUafA/gU7Jo7IyyVxvO+ntMrZ3y8NTxdyuzsEsn0p0
</preKeyPublic>
</prekeys>
</bundle>
</item>
</publish>
</pubsub>
</iq>
2021-01-23 08:07:43.297 12826-13552/org.atalk.android D/SMACK: RECV (0):
<message to='peacock@atalk.sytes.net/atalk' from='peacock@atalk.sytes.net' type='headline'>
<event xmlns='http://jabber.org/protocol/pubsub#event'>
<items node='eu.siacs.conversations.axolotl.bundles:1966536913'>
<item id='64B5800B6767E'>
<bundle xmlns='eu.siacs.conversations.axolotl'>
<signedPreKeyPublic signedPreKeyId='1'>
BSLyWws2FkR10UoDLmnWFf5C63YTC3eFuBaRgqeIffkA
</signedPreKeyPublic>
<signedPreKeySignature>
zGyTbE02UHrOW2M1ga4szdsETi7nIPp6K7G9FC5acWUQGt+JLQyG23UC4EYB5qf5j75WX931YkpaVIfj1bhIBA==
</signedPreKeySignature>
<identityKey>
BfnGBADzVw8VPpDqd4KS9aVHJbWafvIPW4/Gw5Ds7eBf
</identityKey>
<prekeys>
<preKeyPublic preKeyId='1'>
BYjl5vnY8yVID+soGOatBCavTP/wP1mhBgE1Ihs82PFR
</preKeyPublic>
<preKeyPublic preKeyId='100'>
BeVUafA/gU7Jo7IyyVxvO+ntMrZ3y8NTxdyuzsEsn0p0
</preKeyPublic>
</prekeys>
</bundle>
</item>
</items>
</event>
<addresses xmlns='http://jabber.org/protocol/address'>
<address jid='peacock@atalk.sytes.net/atalk' type='replyto'/>
</addresses>
</message>
2021-01-23 08:07:43.346 12826-13552/org.atalk.android D/SMACK: RECV (0):
<iq xml:lang='en-GB' to='peacock@atalk.sytes.net/atalk' from='peacock@atalk.sytes.net' type='result' id='ZTN97-44'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<publish node='eu.siacs.conversations.axolotl.bundles:1966536913'>
<item id='64B5800B6767E'/>
</publish>
</pubsub>
</iq>
2021-01-23 08:07:43.363 12826-13551/org.atalk.android D/SMACK: SENT (0):
<iq id='ZTN97-46' type='get'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<items node='eu.siacs.conversations.axolotl.devicelist'/>
</pubsub>
</iq>
<a xmlns='urn:xmpp:sm:3' h='77'/>
2021-01-23 08:07:43.380 12826-13552/org.atalk.android D/SMACK: RECV (0):
<iq xml:lang='en-GB' to='peacock@atalk.sytes.net/atalk' from='peacock@atalk.sytes.net' type='result' id='ZTN97-46'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<items node='eu.siacs.conversations.axolotl.devicelist'>
<item id='64B57EEA619D0'>
<list xmlns='eu.siacs.conversations.axolotl'>
<device id='648420352'/>
</list>
</item>
</items>
</pubsub>
</iq>
2021-01-23 08:07:43.396 12826-14892/org.atalk.android D/(DatabaseBackend.java:1012)#storeCachedDeviceList: Identities table - updating for activeDevice: peacock@atalk.sytes.net:[648420352]
2021-01-23 08:07:43.399 12826-14892/org.atalk.android D/(DatabaseBackend.java:1025)#storeCachedDeviceList: Identities table - create new activeDevice: peacock@atalk.sytes.net:648420352
2021-01-23 08:07:43.405 12826-14892/org.atalk.android I/(DatabaseBackend.java:1041)#storeCachedDeviceList: Identities table updated for inactiveDevice: peacock@atalk.sytes.net:[1966536913]
2021-01-23 08:07:43.424 12826-14892/org.atalk.android D/(DatabaseBackend.java:1012)#storeCachedDeviceList: Identities table - updating for activeDevice: peacock@atalk.sytes.net:[648420352, 1966536913]
2021-01-23 08:07:43.430 12826-14892/org.atalk.android I/(DatabaseBackend.java:1041)#storeCachedDeviceList: Identities table updated for inactiveDevice: peacock@atalk.sytes.net:[]
2021-01-23 08:07:43.440 12826-13551/org.atalk.android D/SMACK: SENT (0):
<iq id='ZTN97-48' type='set'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<publish node='eu.siacs.conversations.axolotl.devicelist'>
<item>
<list xmlns='eu.siacs.conversations.axolotl'>
<device id='648420352'/>
<device id='1966536913'/>
</list>
</item>
</publish>
</pubsub>
</iq>
2021-01-23 08:07:43.493 12826-13552/org.atalk.android D/SMACK: RECV (0):
<message to='peacock@atalk.sytes.net/atalk' from='peacock@atalk.sytes.net' type='headline'>
<event xmlns='http://jabber.org/protocol/pubsub#event'>
<items node='eu.siacs.conversations.axolotl.devicelist'>
<item id='64B5800B99E57'>
<list xmlns='eu.siacs.conversations.axolotl'>
<device id='648420352'/>
<device id='1966536913'/>
</list>
</item>
</items>
</event>
<addresses xmlns='http://jabber.org/protocol/address'>
<address jid='peacock@atalk.sytes.net/atalk' type='replyto'/>
</addresses>
</message>
2021-01-23 08:07:43.521 12826-13552/org.atalk.android D/SMACK: RECV (0):
<iq xml:lang='en-GB' to='peacock@atalk.sytes.net/atalk' from='peacock@atalk.sytes.net' type='result' id='ZTN97-48'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<publish node='eu.siacs.conversations.axolotl.devicelist'>
<item id='64B5800B99E57'/>
</publish>
</pubsub>
</iq>
2021-01-23 08:07:43.532 12826-14892/org.atalk.android D/(AndroidOmemoService.java:113)#initializationFinished: Initialize OmemoManager successful for peacock@atalk.sytes.net/atalk
2021-01-23 08:07:43.534 12826-14891/org.atalk.android D/(DatabaseBackend.java:1012)#storeCachedDeviceList: Identities table - updating for activeDevice: peacock@atalk.sytes.net:[648420352, 1966536913]
2021-01-23 08:07:43.534 12826-13552/org.atalk.android D/SMACK: RECV (0):
<message to='peacock@atalk.sytes.net/atalk' from='peacock@atalk.sytes.net' type='headline'>
<event xmlns='http://jabber.org/protocol/pubsub#event'>
<items node='eu.siacs.conversations.axolotl.devicelist'>
<item id='64B5800B99E57'>
<list xmlns='eu.siacs.conversations.axolotl'>
<device id='648420352'/>
<device id='1966536913'/>
</list>
</item>
</items>
</event>
<addresses xmlns='http://jabber.org/protocol/address'>
<address jid='peacock@atalk.sytes.net/atalk' type='replyto'/>
</addresses>
</message>
2021-01-23 08:07:43.543 12826-14891/org.atalk.android I/(DatabaseBackend.java:1041)#storeCachedDeviceList: Identities table updated for inactiveDevice: peacock@atalk.sytes.net:[]
2021-01-23 08:07:43.569 12826-14891/org.atalk.android D/(DatabaseBackend.java:1012)#storeCachedDeviceList: Identities table - updating for activeDevice: peacock@atalk.sytes.net:[648420352, 1966536913]
2021-01-23 08:07:43.575 12826-14891/org.atalk.android I/(DatabaseBackend.java:1041)#storeCachedDeviceList: Identities table updated for inactiveDevice: peacock@atalk.sytes.net:[]
2021-01-23 08:07:43.585 12826-14891/org.atalk.android D/(DatabaseBackend.java:1012)#storeCachedDeviceList: Identities table - updating for activeDevice: peacock@atalk.sytes.net:[648420352, 1966536913]
2021-01-23 08:07:43.591 12826-14891/org.atalk.android I/(DatabaseBackend.java:1041)#storeCachedDeviceList: Identities table updated for inactiveDevice: peacock@atalk.sytes.net:[]
2021-01-23 08:07:43.606 12826-14891/org.atalk.android D/(DatabaseBackend.java:1012)#storeCachedDeviceList: Identities table - updating for activeDevice: peacock@atalk.sytes.net:[648420352, 1966536913]
2021-01-23 08:07:43.612 12826-14891/org.atalk.android I/(DatabaseBackend.java:1041)#storeCachedDeviceList: Identities table updated for inactiveDevice: peacock@atalk.sytes.net:[]
2021-01-23 08:07:43.622 12826-14891/org.atalk.android D/(DatabaseBackend.java:1012)#storeCachedDeviceList: Identities table - updating for activeDevice: peacock@atalk.sytes.net:[648420352, 1966536913]
2021-01-23 08:07:43.627 12826-14891/org.atalk.android I/(DatabaseBackend.java:1041)#storeCachedDeviceList: Identities table updated for inactiveDevice: peacock@atalk.sytes.net:[]
2021-01-23 08:07:43.641 12826-14891/org.atalk.android D/(DatabaseBackend.java:1012)#storeCachedDeviceList: Identities table - updating for activeDevice: peacock@atalk.sytes.net:[648420352, 1966536913]
2021-01-23 08:07:43.646 12826-14891/org.atalk.android I/(DatabaseBackend.java:1041)#storeCachedDeviceList: Identities table updated for inactiveDevice: peacock@atalk.sytes.net:[]
2021-01-23 08:07:43.654 12826-14891/org.atalk.android D/(DatabaseBackend.java:1012)#storeCachedDeviceList: Identities table - updating for activeDevice: peacock@atalk.sytes.net:[648420352, 1966536913]
2021-01-23 08:07:43.659 12826-14891/org.atalk.android I/(DatabaseBackend.java:1041)#storeCachedDeviceList: Identities table updated for inactiveDevice: peacock@atalk.sytes.net:[]
2021-01-23 08:07:43.672 12826-14891/org.atalk.android D/(DatabaseBackend.java:1012)#storeCachedDeviceList: Identities table - updating for activeDevice: peacock@atalk.sytes.net:[648420352, 1966536913]
2021-01-23 08:07:43.677 12826-14891/org.atalk.android I/(DatabaseBackend.java:1041)#storeCachedDeviceList: Identities table updated for inactiveDevice: peacock@atalk.sytes.net:[]
=========== sending omemo message between peacock to swordfish ==========
2021-01-23 08:36:25.385 12826-13552/org.atalk.android D/SMACK: RECV (0):
<message xml:lang='en' to='peacock@atalk.sytes.net/atalk' from='swordfish@atalk.sytes.net/atalk' type='chat' id='1611362180107266596046'>
<encrypted xmlns='eu.siacs.conversations.axolotl'>
<header sid='82553717'>
<key rid='648420352'>
MwohBTnU7NJlSeYAIR/RmXM0vEz9j8KMFXRyyPqRBZneujlkEAAYACIwx+ZWvwnuGXxpxtQVyK6o6/V4vSVIRkSFueq6qoov8rIcxXQ1yPzfDXb00Fjh83extdSlZv9MsFE=
</key>
<key prekey='true' rid='1966536913'>
MwgVEiEFnevX95gb5u//pq/RmM1vJxYXeP5ddytLBZ3koaCMmWMaIQXkM+ePcDIY5Ru0ze3cYmIE+9Zdb3/q2z7nT9JA/xZ/OCJiMwohBTggkIbKEbuJQBiEjWPGYFhADbF8AebgXGj+cDThJUdLEAAYACIwMGlyCzlKYmyAbRVxdMcAqAQIanK6L0JWi4w9kff9IfqpV8w9nTBSll5K4Dh1IH5qsSqqe/RWVbgoADAB
</key>
<iv>
D/yV4N6QyqW24qg1
</iv>
</header>
<payload>
gdC4
</payload>
</encrypted>
<store xmlns='urn:xmpp:hints'/>
<encryption xmlns='urn:xmpp:eme:0' namespace='eu.siacs.conversations.axolotl' name='OMEMO'/>
<origin-id xmlns='urn:xmpp:sid:0' id='FW51-WGWE-I7R8-Y'/>
<active xmlns='http://jabber.org/protocol/chatstates'/>
<request xmlns='urn:xmpp:receipts'/>
<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>
2021-01-23 08:36:39.102 12826-16485/org.atalk.android E/AndroidRuntime: FATAL EXCEPTION: Thread-120
Process: org.atalk.android, PID: 12826
java.lang.IllegalArgumentException: Null values!
at org.whispersystems.libsignal.ratchet.AliceSignalProtocolParameters.<init>(AliceSignalProtocolParameters.java:38)
at org.whispersystems.libsignal.ratchet.AliceSignalProtocolParameters.<init>(AliceSignalProtocolParameters.java:14)
at org.whispersystems.libsignal.ratchet.AliceSignalProtocolParameters$Builder.create(AliceSignalProtocolParameters.java:110)
at org.whispersystems.libsignal.SessionBuilder.process(SessionBuilder.java:201)
at org.jivesoftware.smackx.omemo.signal.SignalOmemoService.processBundle(SignalOmemoService.java:104)
at org.jivesoftware.smackx.omemo.signal.SignalOmemoService.processBundle(SignalOmemoService.java:48)
at org.jivesoftware.smackx.omemo.OmemoService.buildFreshSessionWithDevice(OmemoService.java:803)
at org.jivesoftware.smackx.omemo.OmemoService.repairBrokenSessionWithPreKeyMessage(OmemoService.java:1335)
at org.jivesoftware.smackx.omemo.OmemoService.onOmemoMessageStanzaReceived(OmemoService.java:1213)
at org.jivesoftware.smackx.omemo.OmemoManager$3.run(OmemoManager.java:959)
at java.lang.Thread.run(Thread.java:764)
2021-01-23 08:36:39.105 12826-16485/org.atalk.android E/(UtilActivator.java:90)#uncaughtException: An uncaught exception occurred in thread = Thread[Thread-120,5,main] and message was: Null values!
java.lang.IllegalArgumentException: Null values!
at org.whispersystems.libsignal.ratchet.AliceSignalProtocolParameters.<init>(AliceSignalProtocolParameters.java:38)
at org.whispersystems.libsignal.ratchet.AliceSignalProtocolParameters.<init>(AliceSignalProtocolParameters.java:14)
at org.whispersystems.libsignal.ratchet.AliceSignalProtocolParameters$Builder.create(AliceSignalProtocolParameters.java:110)
at org.whispersystems.libsignal.SessionBuilder.process(SessionBuilder.java:201)
at org.jivesoftware.smackx.omemo.signal.SignalOmemoService.processBundle(SignalOmemoService.java:104)
at org.jivesoftware.smackx.omemo.signal.SignalOmemoService.processBundle(SignalOmemoService.java:48)
at org.jivesoftware.smackx.omemo.OmemoService.buildFreshSessionWithDevice(OmemoService.java:803)
at org.jivesoftware.smackx.omemo.OmemoService.repairBrokenSessionWithPreKeyMessage(OmemoService.java:1335)
at org.jivesoftware.smackx.omemo.OmemoService.onOmemoMessageStanzaReceived(OmemoService.java:1213)
at org.jivesoftware.smackx.omemo.OmemoManager$3.run(OmemoManager.java:959)
at java.lang.Thread.run(Thread.java:764)