From cb23e3a930c1e8f9a00847b988ac4f51ac8b4cc2 Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Thu, 12 Jan 2017 10:33:23 -0800 Subject: [PATCH] Untrusted identity is not always a legacy message content Closes #5924 Fixes #5922 // FREEBIE --- src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java b/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java index b4c34d834e..99bbff1d1c 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java @@ -604,9 +604,10 @@ public class PushDecryptJob extends ContextJob { EncryptingSmsDatabase database = DatabaseFactory.getEncryptingSmsDatabase(context); Recipients recipients = RecipientFactory.getRecipientsFromString(context, envelope.getSource(), false); long recipientId = recipients.getPrimaryRecipient().getRecipientId(); - PreKeySignalMessage whisperMessage = new PreKeySignalMessage(envelope.getLegacyMessage()); + byte[] ciphertext = envelope.hasLegacyMessage() ? envelope.getLegacyMessage() : envelope.getContent(); + PreKeySignalMessage whisperMessage = new PreKeySignalMessage(ciphertext); IdentityKey identityKey = whisperMessage.getIdentityKey(); - String encoded = Base64.encodeBytes(envelope.getLegacyMessage()); + String encoded = Base64.encodeBytes(ciphertext); IncomingTextMessage textMessage = new IncomingTextMessage(envelope.getSource(), envelope.getSourceDevice(), envelope.getTimestamp(), encoded, Optional.absent(), 0);