what-the-bank/sources/com/facetec/sdk/md.java

90 lines
2.9 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.facetec.sdk;
import java.security.NoSuchAlgorithmException;
import java.security.Provider;
import java.util.List;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.X509TrustManager;
import org.conscrypt.Conscrypt;
/* loaded from: classes.dex */
public final class md extends mi {
private md() {
}
private static Provider b() {
return Conscrypt.newProviderBuilder().provideTrustManager().build();
}
@Override // com.facetec.sdk.mi
public final X509TrustManager c(SSLSocketFactory sSLSocketFactory) {
if (!Conscrypt.isConscrypt(sSLSocketFactory)) {
return super.c(sSLSocketFactory);
}
try {
Object b = b(sSLSocketFactory, Object.class, "sslParameters");
if (b != null) {
return (X509TrustManager) b(b, X509TrustManager.class, "x509TrustManager");
}
return null;
} catch (Exception e) {
throw new UnsupportedOperationException("clientBuilder.sslSocketFactory(SSLSocketFactory) not supported on Conscrypt", e);
}
}
@Override // com.facetec.sdk.mi
public final void e(SSLSocket sSLSocket, String str, List<kd> list) {
if (Conscrypt.isConscrypt(sSLSocket)) {
if (str != null) {
Conscrypt.setUseSessionTickets(sSLSocket, true);
Conscrypt.setHostname(sSLSocket, str);
}
Conscrypt.setApplicationProtocols(sSLSocket, (String[]) mi.b(list).toArray(new String[0]));
return;
}
super.e(sSLSocket, str, list);
}
@Override // com.facetec.sdk.mi
public final String c(SSLSocket sSLSocket) {
if (Conscrypt.isConscrypt(sSLSocket)) {
return Conscrypt.getApplicationProtocol(sSLSocket);
}
return super.c(sSLSocket);
}
@Override // com.facetec.sdk.mi
public final SSLContext d() {
try {
return SSLContext.getInstance("TLSv1.3", b());
} catch (NoSuchAlgorithmException e) {
try {
return SSLContext.getInstance(org.apache.http.conn.ssl.SSLSocketFactory.TLS, b());
} catch (NoSuchAlgorithmException unused) {
throw new IllegalStateException("No TLS provider", e);
}
}
}
public static md e() {
try {
Class.forName("org.conscrypt.Conscrypt");
if (Conscrypt.isAvailable()) {
return new md();
}
return null;
} catch (ClassNotFoundException unused) {
return null;
}
}
@Override // com.facetec.sdk.mi
public final void d(SSLSocketFactory sSLSocketFactory) {
if (Conscrypt.isConscrypt(sSLSocketFactory)) {
Conscrypt.setUseEngineSocket(sSLSocketFactory, true);
}
}
}