aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/src/main/java/org/whispersystems/libaxolotl/groups/GroupCipher.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/java/src/main/java/org/whispersystems/libaxolotl/groups/GroupCipher.java b/java/src/main/java/org/whispersystems/libaxolotl/groups/GroupCipher.java
index 55e261ac..cac2ccd8 100644
--- a/java/src/main/java/org/whispersystems/libaxolotl/groups/GroupCipher.java
+++ b/java/src/main/java/org/whispersystems/libaxolotl/groups/GroupCipher.java
@@ -102,7 +102,7 @@ public class GroupCipher {
* @throws DuplicateMessageException
*/
public byte[] decrypt(byte[] senderKeyMessageBytes)
- throws LegacyMessageException, DuplicateMessageException, InvalidMessageException
+ throws LegacyMessageException, DuplicateMessageException, InvalidMessageException, NoSessionException
{
return decrypt(senderKeyMessageBytes, new NullDecryptionCallback());
}
@@ -123,11 +123,17 @@ public class GroupCipher {
* @throws DuplicateMessageException
*/
public byte[] decrypt(byte[] senderKeyMessageBytes, DecryptionCallback callback)
- throws LegacyMessageException, InvalidMessageException, DuplicateMessageException
+ throws LegacyMessageException, InvalidMessageException, DuplicateMessageException,
+ NoSessionException
{
synchronized (LOCK) {
try {
- SenderKeyRecord record = senderKeyStore.loadSenderKey(senderKeyId);
+ SenderKeyRecord record = senderKeyStore.loadSenderKey(senderKeyId);
+
+ if (record.isEmpty()) {
+ throw new NoSessionException("No sender key for: " + senderKeyId);
+ }
+
SenderKeyMessage senderKeyMessage = new SenderKeyMessage(senderKeyMessageBytes);
SenderKeyState senderKeyState = record.getSenderKeyState(senderKeyMessage.getKeyId());