diff --git a/src/org/thoughtcrime/securesms/transport/PushTransport.java b/src/org/thoughtcrime/securesms/transport/PushTransport.java index 8312d07330..3744ed4108 100644 --- a/src/org/thoughtcrime/securesms/transport/PushTransport.java +++ b/src/org/thoughtcrime/securesms/transport/PushTransport.java @@ -189,7 +189,7 @@ public class PushTransport extends BaseTransport { private void handleMismatchedDevices(PushServiceSocket socket, long threadId, Recipient recipient, MismatchedDevices mismatchedDevices) - throws InvalidNumberException, IOException + throws InvalidNumberException, IOException, UntrustedIdentityException { try { String e164number = Util.canonicalizeNumber(context, recipient.getNumber()); @@ -205,7 +205,11 @@ public class PushTransport extends BaseTransport { PreKeyEntity preKey = socket.getPreKey(address); KeyExchangeProcessorV2 processor = new KeyExchangeProcessorV2(context, masterSecret, address); - processor.processKeyExchangeMessage(preKey, threadId); + if (processor.isTrusted(preKey)) { + processor.processKeyExchangeMessage(preKey, threadId); + } else { + throw new UntrustedIdentityException("Untrusted identity key!", e164number, preKey.getIdentityKey()); + } } } catch (InvalidKeyException e) { throw new IOException(e);