what-the-bank/sources/okhttp3/internal/platform/android/ConscryptSocketAdapter.java

92 lines
3.6 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package okhttp3.internal.platform.android;
import java.util.List;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.X509TrustManager;
import o.C14953gcr;
import o.C14957gcv;
import okhttp3.Protocol;
import okhttp3.internal.platform.ConscryptPlatform;
import okhttp3.internal.platform.Platform;
import okhttp3.internal.platform.android.DeferredSocketAdapter;
import okhttp3.internal.platform.android.SocketAdapter;
import org.conscrypt.Conscrypt;
/* loaded from: classes.dex */
public final class ConscryptSocketAdapter implements SocketAdapter {
public static final Companion Companion = new Companion(null);
private static final DeferredSocketAdapter.Factory factory = new DeferredSocketAdapter.Factory() { // from class: okhttp3.internal.platform.android.ConscryptSocketAdapter$Companion$factory$1
@Override // okhttp3.internal.platform.android.DeferredSocketAdapter.Factory
public final boolean matchesSocket(SSLSocket sSLSocket) {
C14957gcv.e(sSLSocket, "");
return ConscryptPlatform.Companion.isSupported() && Conscrypt.isConscrypt(sSLSocket);
}
@Override // okhttp3.internal.platform.android.DeferredSocketAdapter.Factory
public final SocketAdapter create(SSLSocket sSLSocket) {
C14957gcv.e(sSLSocket, "");
return new ConscryptSocketAdapter();
}
};
@Override // okhttp3.internal.platform.android.SocketAdapter
public final boolean matchesSocketFactory(SSLSocketFactory sSLSocketFactory) {
return SocketAdapter.DefaultImpls.matchesSocketFactory(this, sSLSocketFactory);
}
@Override // okhttp3.internal.platform.android.SocketAdapter
public final X509TrustManager trustManager(SSLSocketFactory sSLSocketFactory) {
return SocketAdapter.DefaultImpls.trustManager(this, sSLSocketFactory);
}
@Override // okhttp3.internal.platform.android.SocketAdapter
public final boolean matchesSocket(SSLSocket sSLSocket) {
C14957gcv.e(sSLSocket, "");
return Conscrypt.isConscrypt(sSLSocket);
}
@Override // okhttp3.internal.platform.android.SocketAdapter
public final boolean isSupported() {
return ConscryptPlatform.Companion.isSupported();
}
@Override // okhttp3.internal.platform.android.SocketAdapter
public final String getSelectedProtocol(SSLSocket sSLSocket) {
C14957gcv.e(sSLSocket, "");
if (matchesSocket(sSLSocket)) {
return Conscrypt.getApplicationProtocol(sSLSocket);
}
return null;
}
@Override // okhttp3.internal.platform.android.SocketAdapter
public final void configureTlsExtensions(SSLSocket sSLSocket, String str, List<? extends Protocol> list) {
C14957gcv.e(sSLSocket, "");
C14957gcv.e(list, "");
if (matchesSocket(sSLSocket)) {
Conscrypt.setUseSessionTickets(sSLSocket, true);
Object[] array = Platform.Companion.alpnProtocolNames(list).toArray(new String[0]);
if (array != null) {
Conscrypt.setApplicationProtocols(sSLSocket, (String[]) array);
return;
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T of kotlin.collections.ArraysKt__ArraysJVMKt.toTypedArray>");
}
}
/* loaded from: classes.dex */
public static final class Companion {
private Companion() {
}
public final DeferredSocketAdapter.Factory getFactory() {
return ConscryptSocketAdapter.factory;
}
public /* synthetic */ Companion(C14953gcr c14953gcr) {
this();
}
}
}