78 lines
3.2 KiB
Java
78 lines
3.2 KiB
Java
package okhttp3.internal.platform.android;
|
|
|
|
import android.net.http.X509TrustManagerExtensions;
|
|
import java.security.cert.Certificate;
|
|
import java.security.cert.CertificateException;
|
|
import java.security.cert.X509Certificate;
|
|
import java.util.List;
|
|
import javax.net.ssl.SSLPeerUnverifiedException;
|
|
import javax.net.ssl.X509TrustManager;
|
|
import o.C14953gcr;
|
|
import o.C14957gcv;
|
|
import okhttp3.internal.tls.CertificateChainCleaner;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class AndroidCertificateChainCleaner extends CertificateChainCleaner {
|
|
public static final Companion Companion = new Companion(null);
|
|
private final X509TrustManager trustManager;
|
|
private final X509TrustManagerExtensions x509TrustManagerExtensions;
|
|
|
|
public AndroidCertificateChainCleaner(X509TrustManager x509TrustManager, X509TrustManagerExtensions x509TrustManagerExtensions) {
|
|
C14957gcv.e(x509TrustManager, "");
|
|
C14957gcv.e(x509TrustManagerExtensions, "");
|
|
this.trustManager = x509TrustManager;
|
|
this.x509TrustManagerExtensions = x509TrustManagerExtensions;
|
|
}
|
|
|
|
@Override // okhttp3.internal.tls.CertificateChainCleaner
|
|
public final List<Certificate> clean(List<? extends Certificate> list, String str) throws SSLPeerUnverifiedException {
|
|
C14957gcv.e(list, "");
|
|
C14957gcv.e(str, "");
|
|
Object[] array = list.toArray(new X509Certificate[0]);
|
|
if (array != null) {
|
|
try {
|
|
List<X509Certificate> checkServerTrusted = this.x509TrustManagerExtensions.checkServerTrusted((X509Certificate[]) array, "RSA", str);
|
|
C14957gcv.c(checkServerTrusted, "");
|
|
return checkServerTrusted;
|
|
} catch (CertificateException e) {
|
|
SSLPeerUnverifiedException sSLPeerUnverifiedException = new SSLPeerUnverifiedException(e.getMessage());
|
|
sSLPeerUnverifiedException.initCause(e);
|
|
throw sSLPeerUnverifiedException;
|
|
}
|
|
}
|
|
throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T of kotlin.collections.ArraysKt__ArraysJVMKt.toTypedArray>");
|
|
}
|
|
|
|
public final boolean equals(Object obj) {
|
|
return (obj instanceof AndroidCertificateChainCleaner) && ((AndroidCertificateChainCleaner) obj).trustManager == this.trustManager;
|
|
}
|
|
|
|
public final int hashCode() {
|
|
return System.identityHashCode(this.trustManager);
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public final AndroidCertificateChainCleaner buildIfSupported(X509TrustManager x509TrustManager) {
|
|
X509TrustManagerExtensions x509TrustManagerExtensions;
|
|
C14957gcv.e(x509TrustManager, "");
|
|
try {
|
|
x509TrustManagerExtensions = new X509TrustManagerExtensions(x509TrustManager);
|
|
} catch (IllegalArgumentException unused) {
|
|
x509TrustManagerExtensions = null;
|
|
}
|
|
if (x509TrustManagerExtensions != null) {
|
|
return new AndroidCertificateChainCleaner(x509TrustManager, x509TrustManagerExtensions);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public /* synthetic */ Companion(C14953gcr c14953gcr) {
|
|
this();
|
|
}
|
|
}
|
|
}
|