187 lines
5.7 KiB
Java
187 lines
5.7 KiB
Java
|
package com.facetec.sdk;
|
||
|
|
||
|
import java.io.IOException;
|
||
|
import java.lang.reflect.Field;
|
||
|
import java.net.InetSocketAddress;
|
||
|
import java.net.Socket;
|
||
|
import java.security.NoSuchAlgorithmException;
|
||
|
import java.security.Security;
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.List;
|
||
|
import java.util.logging.Level;
|
||
|
import java.util.logging.Logger;
|
||
|
import javax.net.ssl.SSLContext;
|
||
|
import javax.net.ssl.SSLSocket;
|
||
|
import javax.net.ssl.SSLSocketFactory;
|
||
|
import javax.net.ssl.X509TrustManager;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public class mi {
|
||
|
private static final mi c;
|
||
|
private static final Logger e;
|
||
|
|
||
|
public void b(SSLSocket sSLSocket) {
|
||
|
}
|
||
|
|
||
|
public String c(SSLSocket sSLSocket) {
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
public boolean c(String str) {
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
public void d(SSLSocketFactory sSLSocketFactory) {
|
||
|
}
|
||
|
|
||
|
public void e(SSLSocket sSLSocket, String str, List<kd> list) {
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: protected */
|
||
|
public X509TrustManager c(SSLSocketFactory sSLSocketFactory) {
|
||
|
try {
|
||
|
Object b = b(sSLSocketFactory, Class.forName("sun.security.ssl.SSLContextImpl"), "context");
|
||
|
if (b == null) {
|
||
|
return null;
|
||
|
}
|
||
|
return (X509TrustManager) b(b, X509TrustManager.class, "trustManager");
|
||
|
} catch (ClassNotFoundException unused) {
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void c(Socket socket, InetSocketAddress inetSocketAddress, int i) throws IOException {
|
||
|
socket.connect(inetSocketAddress, i);
|
||
|
}
|
||
|
|
||
|
public void d(int i, String str, Throwable th) {
|
||
|
e.log(i == 5 ? Level.WARNING : Level.INFO, str, th);
|
||
|
}
|
||
|
|
||
|
public Object a(String str) {
|
||
|
if (e.isLoggable(Level.FINE)) {
|
||
|
return new Throwable(str);
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
public void c(String str, Object obj) {
|
||
|
if (obj == null) {
|
||
|
StringBuilder sb = new StringBuilder();
|
||
|
sb.append(str);
|
||
|
sb.append(" To see where this was allocated, set the OkHttpClient logger level to FINE: Logger.getLogger(OkHttpClient.class.getName()).setLevel(Level.FINE);");
|
||
|
str = sb.toString();
|
||
|
}
|
||
|
d(5, str, (Throwable) obj);
|
||
|
}
|
||
|
|
||
|
public static List<String> b(List<kd> list) {
|
||
|
ArrayList arrayList = new ArrayList(list.size());
|
||
|
int size = list.size();
|
||
|
for (int i = 0; i < size; i++) {
|
||
|
kd kdVar = list.get(i);
|
||
|
if (kdVar != kd.HTTP_1_0) {
|
||
|
arrayList.add(kdVar.toString());
|
||
|
}
|
||
|
}
|
||
|
return arrayList;
|
||
|
}
|
||
|
|
||
|
public mm a(X509TrustManager x509TrustManager) {
|
||
|
return new ml(b(x509TrustManager));
|
||
|
}
|
||
|
|
||
|
public final mm a(SSLSocketFactory sSLSocketFactory) {
|
||
|
X509TrustManager c2 = c(sSLSocketFactory);
|
||
|
if (c2 == null) {
|
||
|
StringBuilder sb = new StringBuilder("Unable to extract the trust manager on ");
|
||
|
sb.append(c());
|
||
|
sb.append(", sslSocketFactory is ");
|
||
|
sb.append(sSLSocketFactory.getClass());
|
||
|
throw new IllegalStateException(sb.toString());
|
||
|
}
|
||
|
return a(c2);
|
||
|
}
|
||
|
|
||
|
private static boolean b() {
|
||
|
if ("conscrypt".equals(System.getProperty("okhttp.platform"))) {
|
||
|
return true;
|
||
|
}
|
||
|
return "Conscrypt".equals(Security.getProviders()[0].getName());
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public static byte[] d(List<kd> list) {
|
||
|
ms msVar = new ms();
|
||
|
int size = list.size();
|
||
|
for (int i = 0; i < size; i++) {
|
||
|
kd kdVar = list.get(i);
|
||
|
if (kdVar != kd.HTTP_1_0) {
|
||
|
msVar.h(kdVar.toString().length());
|
||
|
msVar.e(kdVar.toString());
|
||
|
}
|
||
|
}
|
||
|
return msVar.l();
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public static <T> T b(Object obj, Class<T> cls, String str) {
|
||
|
do {
|
||
|
for (Class<?> cls2 = obj.getClass(); cls2 != Object.class; cls2 = cls2.getSuperclass()) {
|
||
|
try {
|
||
|
Field declaredField = cls2.getDeclaredField(str);
|
||
|
declaredField.setAccessible(true);
|
||
|
Object obj2 = declaredField.get(obj);
|
||
|
if (obj2 != null && cls.isInstance(obj2)) {
|
||
|
return cls.cast(obj2);
|
||
|
}
|
||
|
return null;
|
||
|
} catch (IllegalAccessException unused) {
|
||
|
throw new AssertionError();
|
||
|
} catch (NoSuchFieldException unused2) {
|
||
|
}
|
||
|
}
|
||
|
if (str.equals("delegate")) {
|
||
|
break;
|
||
|
}
|
||
|
obj = b(obj, Object.class, "delegate");
|
||
|
} while (obj != null);
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
public SSLContext d() {
|
||
|
if ("1.7".equals(System.getProperty("java.specification.version"))) {
|
||
|
try {
|
||
|
return SSLContext.getInstance("TLSv1.2");
|
||
|
} catch (NoSuchAlgorithmException unused) {
|
||
|
}
|
||
|
}
|
||
|
try {
|
||
|
return SSLContext.getInstance(org.apache.http.conn.ssl.SSLSocketFactory.TLS);
|
||
|
} catch (NoSuchAlgorithmException e2) {
|
||
|
throw new IllegalStateException("No TLS provider", e2);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public mq b(X509TrustManager x509TrustManager) {
|
||
|
return new mp(x509TrustManager.getAcceptedIssuers());
|
||
|
}
|
||
|
|
||
|
public String toString() {
|
||
|
return getClass().getSimpleName();
|
||
|
}
|
||
|
|
||
|
static {
|
||
|
mi e2 = mg.e();
|
||
|
if (e2 == null && ((!b() || (e2 = md.e()) == null) && (e2 = mc.a()) == null && (e2 = me.b()) == null)) {
|
||
|
e2 = new mi();
|
||
|
}
|
||
|
c = e2;
|
||
|
e = Logger.getLogger(ka.class.getName());
|
||
|
}
|
||
|
|
||
|
public static mi c() {
|
||
|
return c;
|
||
|
}
|
||
|
}
|