Don't escape passwords in SASL

Fixes #671
This commit is contained in:
Sam Whited 2014-11-15 21:09:51 -05:00
parent 2067b9bd8d
commit cfdda5f8fd
2 changed files with 3 additions and 3 deletions

View file

@ -52,7 +52,7 @@ public class ScramSha1 extends SaslMechanism {
final String[] kparts = k.split(",", 4);
try {
final byte[] saltedPassword, serverKey, clientKey;
saltedPassword = hi(CryptoHelper.saslPrep(CryptoHelper.hexToString(kparts[1])).getBytes(),
saltedPassword = hi(CryptoHelper.hexToString(kparts[1]).getBytes(),
Base64.decode(CryptoHelper.hexToString(kparts[2]), Base64.DEFAULT), Integer.valueOf(kparts[3]));
serverKey = hmac(saltedPassword, SERVER_KEY_BYTES);
clientKey = hmac(saltedPassword, CLIENT_KEY_BYTES);
@ -88,7 +88,7 @@ public class ScramSha1 extends SaslMechanism {
@Override
public String getClientFirstMessage() {
if (clientFirstMessageBare.isEmpty() && state == State.INITIAL) {
clientFirstMessageBare = "n=" + CryptoHelper.saslPrep(account.getUsername()) +
clientFirstMessageBare = "n=" + CryptoHelper.saslEscape(CryptoHelper.saslPrep(account.getUsername())) +
",r=" + this.clientNonce;
state = State.AUTH_TEXT_SENT;
}

View file

@ -80,7 +80,7 @@ public class CryptoHelper {
}
public static String saslPrep(final String s) {
return saslEscape(Normalizer.normalize(s, Normalizer.Form.NFKC));
return Normalizer.normalize(s, Normalizer.Form.NFKC);
}
public static String prettifyFingerprint(String fingerprint) {