diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-06-29 17:18:57 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-06-30 16:53:44 +0200 |
commit | 63be56ab0723eb072ea67d0ee768f09a59bfc0b0 (patch) | |
tree | 0ff7474234d56ef5a16320ff10288c93d0c4ba65 /src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java | |
parent | 845bb3f7363893cd8539dbbcbb75c2215ea9b3ea (diff) |
don't crash on broken base64 in omemo messages. fixes #1934
Diffstat (limited to 'src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java b/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java index 93a736778..e8ec54263 100644 --- a/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java +++ b/src/main/java/eu/siacs/conversations/crypto/axolotl/XmppAxolotlMessage.java @@ -99,7 +99,7 @@ public class XmppAxolotlMessage { case KEYTAG: try { Integer recipientId = Integer.parseInt(keyElement.getAttribute(REMOTEID)); - byte[] key = Base64.decode(keyElement.getContent(), Base64.DEFAULT); + byte[] key = Base64.decode(keyElement.getContent().trim(), Base64.DEFAULT); this.keys.put(recipientId, key); } catch (NumberFormatException e) { throw new IllegalArgumentException(e); @@ -109,7 +109,7 @@ public class XmppAxolotlMessage { if (this.iv != null) { throw new IllegalArgumentException("Duplicate iv entry"); } - iv = Base64.decode(keyElement.getContent(), Base64.DEFAULT); + iv = Base64.decode(keyElement.getContent().trim(), Base64.DEFAULT); break; default: Log.w(Config.LOGTAG, "Unexpected element in header: " + keyElement.toString()); @@ -118,7 +118,7 @@ public class XmppAxolotlMessage { } Element payloadElement = axolotlMessage.findChild(PAYLOAD); if (payloadElement != null) { - ciphertext = Base64.decode(payloadElement.getContent(), Base64.DEFAULT); + ciphertext = Base64.decode(payloadElement.getContent().trim(), Base64.DEFAULT); } } |