Skip to content

Commit

Permalink
Check prekey identity on mismatched devices too.
Browse files Browse the repository at this point in the history
  • Loading branch information
moxie0 committed Feb 17, 2014
1 parent 6b57533 commit d8e1df9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/org/thoughtcrime/securesms/transport/PushTransport.java
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ private PushAttachmentPointer getPushAttachmentPointer(PushServiceSocket socket,
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());
Expand All @@ -205,7 +205,11 @@ private void handleMismatchedDevices(PushServiceSocket socket, long threadId,
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);
Expand Down

0 comments on commit d8e1df9

Please sign in to comment.