PapaTutuWawa / omemo_dart

A Dart implementation of the cryptography needed for OMEMO 0.8.3 (mirror)
https://codeberg.org/PapaTutuWawa/omemo_dart
MIT License
16 stars 1 forks source link

Using the OmemoSessionManager to encrypt a second message to a Jid will causes an invalid HMAC exception #14

Closed PapaTutuWawa closed 2 years ago

PapaTutuWawa commented 2 years ago

See the test Test by sending multiple messages back and forth in test/omemo_test.dart.

Edit: This bug does not seem to be triggered due to a bad ratchet since the Double Ratchet tests do not fail.

Unhandled exception:
Instance of 'InvalidMessageHMACException'
#0      decrypt (package:omemo_dart/src/double_ratchet/crypto.dart:44:5)
<asynchronous suspension>
#1      OmemoSessionManager.decryptMessage.<anonymous closure> (package:omemo_dart/src/omemo/sessionmanager.dart:329:22)
<asynchronous suspension>
#2      BasicLock.synchronized (package:synchronized/src/basic_lock.dart:33:16)
<asynchronous suspension>
#3      OmemoSessionManager.decryptMessage (package:omemo_dart/src/omemo/sessionmanager.dart:324:5)
<asynchronous suspension>
#4      OmemoEncryptionImplementation.decryptStanza (package:xmpp_omemo/src/transformers/message.dart:151:22)
<asynchronous suspension>
#5      OmemoMessageTransformer.transformToData (package:xmpp_omemo/src/transformers/message.dart:198:23)
<asynchronous suspension>
#6      MessageTransformerManager.transformToData (package:xmpp_im/src/transformers/manager.dart:92:22)
<asynchronous suspension>
#7      Stream.asyncMap.<anonymous closure>.add (dart:async/stream.dart:742:7)
<asynchronous suspension
PapaTutuWawa commented 2 years ago

Fixed in d0986a4608061485b2c34d8dc6ddac28da468206.