mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-16 22:05:07 -05:00
8d2f454479
DIGEST-MD5 seems to be broken for a lot of cases (OpenFire) switched priority of PLAIN to not cause any security errors
31 lines
708 B
Java
31 lines
708 B
Java
package eu.siacs.conversations.crypto.sasl;
|
|
|
|
import android.util.Base64;
|
|
|
|
import java.nio.charset.Charset;
|
|
|
|
import eu.siacs.conversations.entities.Account;
|
|
import eu.siacs.conversations.xml.TagWriter;
|
|
|
|
public class Plain extends SaslMechanism {
|
|
public Plain(final TagWriter tagWriter, final Account account) {
|
|
super(tagWriter, account, null);
|
|
}
|
|
|
|
@Override
|
|
public int getPriority() {
|
|
return 10;
|
|
}
|
|
|
|
@Override
|
|
public String getMechanism() {
|
|
return "PLAIN";
|
|
}
|
|
|
|
@Override
|
|
public String getClientFirstMessage() {
|
|
final String sasl = '\u0000' + account.getUsername() + '\u0000' + account.getPassword();
|
|
return Base64.encodeToString(sasl.getBytes(Charset.defaultCharset()), Base64.NO_WRAP);
|
|
}
|
|
}
|