diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2014-12-03 01:43:23 +0100 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2014-12-03 01:43:23 +0100 |
commit | 605998c966d96823233f98cc43883d040aa810d7 (patch) | |
tree | 01afbd0c350fac3dc215c01dfd7c12c0c36743e8 /src | |
parent | 46b2760069874cda80a8f23f20adaa886c422f59 (diff) | |
parent | feec659b08661e822c700347c4cf4734a79841a8 (diff) |
Merge pull request #744 from SamWhited/development
Fix DIGEST-MD5 auth
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/sasl/DigestMd5.java | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/crypto/sasl/Tokenizer.java | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/eu/siacs/conversations/crypto/sasl/DigestMd5.java b/src/main/java/eu/siacs/conversations/crypto/sasl/DigestMd5.java index 850cacc2a..55c38f409 100644 --- a/src/main/java/eu/siacs/conversations/crypto/sasl/DigestMd5.java +++ b/src/main/java/eu/siacs/conversations/crypto/sasl/DigestMd5.java @@ -39,7 +39,7 @@ public class DigestMd5 extends SaslMechanism { final Tokenizer tokenizer = new Tokenizer(Base64.decode(challenge, Base64.DEFAULT)); String nonce = ""; for (final String token : tokenizer) { - final String[] parts = token.split("="); + final String[] parts = token.split("=", 2); if (parts[0].equals("nonce")) { nonce = parts[1].replace("\"", ""); } else if (parts[0].equals("rspauth")) { diff --git a/src/main/java/eu/siacs/conversations/crypto/sasl/Tokenizer.java b/src/main/java/eu/siacs/conversations/crypto/sasl/Tokenizer.java index 39be02246..e37e0fa71 100644 --- a/src/main/java/eu/siacs/conversations/crypto/sasl/Tokenizer.java +++ b/src/main/java/eu/siacs/conversations/crypto/sasl/Tokenizer.java @@ -16,6 +16,10 @@ public final class Tokenizer implements Iterator<String>, Iterable<String> { public Tokenizer(final byte[] challenge) { final String challengeString = new String(challenge); parts = new ArrayList<>(Arrays.asList(challengeString.split(","))); + // Trim parts. + for (int i = 0; i < parts.size(); i++) { + parts.set(i, parts.get(i).trim()); + } index = 0; } |