blob: 27de45247b5460ba1dd5c1d4ecbc2cd1c5b526bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
package de.pixart.messenger.crypto.sasl;
import android.util.Base64;
import java.nio.charset.Charset;
import de.pixart.messenger.entities.Account;
import de.pixart.messenger.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);
}
}
|