Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with sealed_sender_multi_recipient_encrypt #499

Closed
Anblak opened this issue Nov 16, 2022 · 6 comments
Closed

Issue with sealed_sender_multi_recipient_encrypt #499

Anblak opened this issue Nov 16, 2022 · 6 comments

Comments

@Anblak
Copy link

Anblak commented Nov 16, 2022

Hey!
My team is using this lib as a part of Turasa project for very important project for Ukraine (mb you know a situation in a country)

We have numerous exceptions like: Non-fatal Exception: java.lang.IllegalStateException: invalid state for call to sealed_sender_multi_recipient_encrypt to succeed: cannot get registration ID from session with 0730c772-7b3c-467a-bbbc-2b296bf0cd81.1 (maybe it was recently archived)

It's breaking our stability (what is very important for us)
Please help with this

Full stacktrace:

Non-fatal Exception: java.lang.IllegalStateException: invalid state for call to sealed_sender_multi_recipient_encrypt to succeed: cannot get registration ID from session with 0730c772-7b3c-467a-bbbc-2b296bf0cd81.1 (maybe it was recently archived)
       at org.signal.libsignal.internal.Native.SealedSessionCipher_MultiRecipientEncrypt(Native.java)
       at org.signal.libsignal.metadata.SealedSessionCipher.multiRecipientEncrypt(SealedSessionCipher.java:115)
       at org.whispersystems.signalservice.api.crypto.SignalSealedSessionCipher.multiRecipientEncrypt(SignalSealedSessionCipher.java:51)
       at org.whispersystems.signalservice.api.crypto.SignalServiceCipher.encryptForGroup(SignalServiceCipher.java:110)
       at org.whispersystems.signalservice.api.SignalServiceMessageSender.sendGroupMessage(SignalServiceMessageSender.java:2028)
       at org.whispersystems.signalservice.api.SignalServiceMessageSender.sendGroupDataMessage(SignalServiceMessageSender.java:463)
       at org.asamk.signal.manager.helper.SendHelper.lambda$sendGroupMessage$10(SendHelper.java:339)
       at org.asamk.signal.manager.helper.SendHelper$$ExternalSyntheticLambda13.send$50b4e1be(SendHelper.java)
       at org.asamk.signal.manager.helper.SendHelper.sendGroupMessageInternalWithSenderKey$17c099ae(SendHelper.java:546)
       at org.asamk.signal.manager.helper.SendHelper.sendGroupMessageInternal(SendHelper.java:416)
       at org.asamk.signal.manager.helper.SendHelper.sendGroupMessage(SendHelper.java:356)
       at org.asamk.signal.manager.helper.SendHelper.sendAsGroupMessage(SendHelper.java:304)
       at org.asamk.signal.manager.helper.SendHelper.sendAsGroupMessage(SendHelper.java:102)
       at org.asamk.signal.manager.ManagerImpl.sendMessage(ManagerImpl.java:498)
       at org.asamk.signal.manager.ManagerImpl.sendMessage(ManagerImpl.java:599)
       at org.asamk.signal.manager.transport.SignalAttachmentBufferedSender.flush(SignalAttachmentBufferedSender.java:68)
       at org.asamk.signal.manager.transport.SignalAttachmentBufferedSender.run(SignalAttachmentBufferedSender.java:49)
       at java.lang.Thread.run(Thread.java:761)
@jrose-signal
Copy link
Contributor

Multi-recipient encryption assumes that you have an active 1:1 session with all recipients already. This is a reasonable assumption within Signal because SenderKey keys are always sent via 1:1 sessions, and since Turasa is using the actual Signal network you're responsible for this too. The registration IDs specifically are used by the server to detect if you're sending to a device that has been unlinked / relinked.

Before sending a multi-recipient message, make sure you have sessions for all participants, just as you would if you were going to send them individual 1:1 messages.

Does that solve your issue?

@Anblak
Copy link
Author

Anblak commented Nov 17, 2022

@jrose-signal Yep, thanks a lot!

@Anblak Anblak closed this as completed Nov 17, 2022
@Anblak
Copy link
Author

Anblak commented Nov 22, 2022

@jrose-signal sorry, have one more question
how to reproduce that? remove connected device and don't update session keys?

@jrose-signal
Copy link
Contributor

You should be able to reproduce by explicitly archiving the current session for a recipient, then immediately trying to send a multi-recipient message to them.

@Anblak
Copy link
Author

Anblak commented Nov 23, 2022

@jrose-signal repoduced, and to fix that - need to delete arhived session from the list or refresh that? (if refresh - than how?)

@jrose-signal
Copy link
Contributor

Refresh, by processing a new pre-key bundle.

[Meta: GitHub Issues isn't the best place for this sort of discussion; it's probably better for the Development section fo the unofficial forums at https://community.signalusers.org/.]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants