blob: 179c12deaea5cf8ff52c0fac3ea0e2937559c95b (
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.thedevstack.conversationsplus.crypto.sasl;
import android.util.Base64;
import java.nio.charset.Charset;
import de.thedevstack.conversationsplus.entities.Account;
import de.thedevstack.conversationsplus.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);
}
}
|