From c4209a65e33fe996dc9f201cf4a8534a7dd3f1ca Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Fri, 5 Sep 2014 10:07:16 -0700 Subject: [PATCH] Don't assert on bad padding. --- .../java/org/whispersystems/libaxolotl/SessionCipher.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/SessionCipher.java b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/SessionCipher.java index e4fac57627..424f3bd0b0 100644 --- a/libaxolotl/src/main/java/org/whispersystems/libaxolotl/SessionCipher.java +++ b/libaxolotl/src/main/java/org/whispersystems/libaxolotl/SessionCipher.java @@ -328,7 +328,9 @@ public class SessionCipher { } } - private byte[] getPlaintext(int version, MessageKeys messageKeys, byte[] cipherText) { + private byte[] getPlaintext(int version, MessageKeys messageKeys, byte[] cipherText) + throws InvalidMessageException + { try { Cipher cipher; @@ -340,7 +342,7 @@ public class SessionCipher { return cipher.doFinal(cipherText); } catch (IllegalBlockSizeException | BadPaddingException e) { - throw new AssertionError(e); + throw new InvalidMessageException(e); } }