powered by Jive Software

Getting DuplicateMessageException while decrypting an Omemo encrypted message from ChatSecure-iOS


We are getting a DuplicateMessageException while decrypting an Omemo encrypted message from ChatSecure(iOS). Omemo encryption is working fine with android to android. Getting following errors from smack:

- SignalOmemoSession: Error decrypting message header, org.whispersystems.libsignal.DuplicateMessageException: Received message with old counter: 1 , 0

- OmemoService: internal omemoMessageListener failed to decrypt incoming OMEMO message: MessageKey has wrong length: 16. Probably legacy auth tag format.

Please help me to find the cause for this incompatibility between chatSecure-iOS and our smack framework.


Hi, were you able to resolve? And does openfire support Omemo now?

Hi Rollan,

That is not an issue with smack. The omemo encrypted message will only be decrypted once. Smack is maintaining a counter. For example, if a user has received messages with counter 0-5, then it can’t decrypt message which having counter in range of 0-5.

Thats only half the truth. Smack doesn’t maintain a counter, but maybe thats a good analogy.

The OMEMO protocol has a property called forward secrecy, which means that “old” messages cannot be decrypted when an attacker manages to compromize a key. For that reason messages can only be decrypted once. When that happens, the internal OMEMO ratchet forwards making it impossible to decrypt the message again.

For you that means, that you have to take care of duplicate messages yourselves by NOT relying on MAM for message archiving for example.