what-the-bank/sources/o/Tzr.java

87 lines
3.6 KiB
Java

package o;
import android.os.Build;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocket;
/* loaded from: classes2.dex */
public abstract class Tzr {
private static final String[] d = {"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256", "TLS_DHE_RSA_WITH_AES_256_GCM_SHA384", "TLS_DHE_DSS_WITH_AES_128_GCM_SHA256", "TLS_DHE_DSS_WITH_AES_256_GCM_SHA384"};
private static final String[] a = {"TLS_RSA", "CBC", "TEA", "SHA0", "MD2", "MD4", "RIPEMD", "NULL", "RC4", "DES", "DESX", "DES40", "RC2", "MD5", "ANON", "TLS_EMPTY_RENEGOTIATION_INFO_SCSV"};
static {
new String[]{"TLS_DHE_DSS_WITH_AES_128_CBC_SHA", "TLS_DHE_RSA_WITH_AES_128_CBC_SHA", "TLS_DHE_DSS_WITH_AES_256_CBC_SHA", "TLS_DHE_RSA_WITH_AES_256_CBC_SHA", "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA", "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA", "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA"};
}
public static void e(SSLSocket sSLSocket) {
int i;
if (sSLSocket == null) {
return;
}
if (sSLSocket != null) {
String[] strArr = d;
if (sSLSocket != null) {
String[] enabledCipherSuites = sSLSocket.getEnabledCipherSuites();
ArrayList arrayList = new ArrayList();
List asList = Arrays.asList(strArr);
for (String str : enabledCipherSuites) {
if (asList.contains(str.toUpperCase(Locale.ENGLISH))) {
arrayList.add(str);
}
}
if (!arrayList.isEmpty()) {
sSLSocket.setEnabledCipherSuites((String[]) arrayList.toArray(new String[arrayList.size()]));
return;
}
}
}
if (sSLSocket != null) {
String[] strArr2 = a;
if (sSLSocket != null) {
String[] enabledCipherSuites2 = sSLSocket.getEnabledCipherSuites();
ArrayList arrayList2 = new ArrayList();
for (String str2 : enabledCipherSuites2) {
String upperCase = str2.toUpperCase(Locale.ENGLISH);
int length = strArr2.length;
while (true) {
if (i < length) {
i = upperCase.contains(strArr2[i].toUpperCase(Locale.ENGLISH)) ? 0 : i + 1;
} else {
arrayList2.add(str2);
break;
}
}
}
if (arrayList2.isEmpty()) {
return;
}
sSLSocket.setEnabledCipherSuites((String[]) arrayList2.toArray(new String[arrayList2.size()]));
}
}
}
public static void a(SSLSocket sSLSocket) {
if (sSLSocket == null) {
return;
}
if (Build.VERSION.SDK_INT >= 29) {
sSLSocket.setEnabledProtocols(new String[]{"TLSv1.3", "TLSv1.2"});
}
if (Build.VERSION.SDK_INT < 29) {
sSLSocket.setEnabledProtocols(new String[]{"TLSv1.2"});
}
}
public static SSLContext d() throws NoSuchAlgorithmException {
if (Build.VERSION.SDK_INT >= 29) {
return SSLContext.getInstance("TLSv1.3");
}
return SSLContext.getInstance("TLSv1.2");
}
}