1package eu.siacs.conversations.crypto.sasl;
2
3import android.util.Log;
4
5import com.google.common.base.CaseFormat;
6
7import eu.siacs.conversations.Config;
8
9public enum ChannelBinding {
10 NONE,
11 TLS_EXPORTER,
12 TLS_SERVER_END_POINT,
13 TLS_UNIQUE;
14
15 public static ChannelBinding of(final String type) {
16 if (type == null) {
17 return null;
18 }
19 try {
20 return valueOf(
21 CaseFormat.LOWER_HYPHEN.converterTo(CaseFormat.UPPER_UNDERSCORE).convert(type));
22 } catch (final IllegalArgumentException e) {
23 Log.d(Config.LOGTAG, type + " is not a known channel binding");
24 return null;
25 }
26 }
27}