package f0; import d0.g; import d0.t.n; import d0.z.d.m; import d0.z.d.o; import f0.f0.c; import java.io.IOException; import java.security.cert.Certificate; import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLSession; import kotlin.Lazy; import kotlin.jvm.functions.Function0; /* compiled from: Handshake.kt */ public final class v { public final Lazy a; public final e0 b; /* renamed from: c reason: collision with root package name */ public final j f2773c; public final List d; /* compiled from: Handshake.kt */ public static final class a extends o implements Function0> { public final /* synthetic */ List $peerCertificatesCopy; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public a(List list) { super(0); this.$peerCertificatesCopy = list; } /* Return type fixed from 'java.lang.Object' to match base method */ @Override // kotlin.jvm.functions.Function0 /* renamed from: invoke */ public List mo1invoke() { return this.$peerCertificatesCopy; } } /* compiled from: Handshake.kt */ public static final class b extends o implements Function0> { public final /* synthetic */ Function0 $peerCertificatesFn; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public b(Function0 function0) { super(0); this.$peerCertificatesFn = function0; } /* Return type fixed from 'java.lang.Object' to match base method */ @Override // kotlin.jvm.functions.Function0 /* renamed from: invoke */ public List mo1invoke() { try { return (List) this.$peerCertificatesFn.mo1invoke(); } catch (SSLPeerUnverifiedException unused) { return n.emptyList(); } } } /* JADX DEBUG: Multi-variable search result rejected for r4v0, resolved type: java.util.List */ /* JADX WARN: Multi-variable type inference failed */ public v(e0 e0Var, j jVar, List list, Function0> function0) { m.checkParameterIsNotNull(e0Var, "tlsVersion"); m.checkParameterIsNotNull(jVar, "cipherSuite"); m.checkParameterIsNotNull(list, "localCertificates"); m.checkParameterIsNotNull(function0, "peerCertificatesFn"); this.b = e0Var; this.f2773c = jVar; this.d = list; this.a = g.lazy(new b(function0)); } public static final v a(SSLSession sSLSession) throws IOException { List list; m.checkParameterIsNotNull(sSLSession, "$this$handshake"); String cipherSuite = sSLSession.getCipherSuite(); if (cipherSuite != null) { int hashCode = cipherSuite.hashCode(); if (hashCode == 1019404634 ? cipherSuite.equals("TLS_NULL_WITH_NULL_NULL") : hashCode == 1208658923 && cipherSuite.equals("SSL_NULL_WITH_NULL_NULL")) { throw new IOException(c.d.b.a.a.t("cipherSuite == ", cipherSuite)); } j b2 = j.f2766s.b(cipherSuite); String protocol = sSLSession.getProtocol(); if (protocol == null) { throw new IllegalStateException("tlsVersion == null".toString()); } else if (!m.areEqual("NONE", protocol)) { e0 a2 = e0.o.a(protocol); try { list = d(sSLSession.getPeerCertificates()); } catch (SSLPeerUnverifiedException unused) { list = n.emptyList(); } return new v(a2, b2, d(sSLSession.getLocalCertificates()), new a(list)); } else { throw new IOException("tlsVersion == NONE"); } } else { throw new IllegalStateException("cipherSuite == null".toString()); } } public static final List d(Certificate[] certificateArr) { return certificateArr != null ? c.m((Certificate[]) Arrays.copyOf(certificateArr, certificateArr.length)) : n.emptyList(); } public final String b(Certificate certificate) { if (certificate instanceof X509Certificate) { return ((X509Certificate) certificate).getSubjectDN().toString(); } String type = certificate.getType(); m.checkExpressionValueIsNotNull(type, "type"); return type; } public final List c() { return (List) this.a.getValue(); } public boolean equals(Object obj) { if (obj instanceof v) { v vVar = (v) obj; if (vVar.b == this.b && m.areEqual(vVar.f2773c, this.f2773c) && m.areEqual(vVar.c(), c()) && m.areEqual(vVar.d, this.d)) { return true; } } return false; } public int hashCode() { int hashCode = this.f2773c.hashCode(); int hashCode2 = c().hashCode(); return this.d.hashCode() + ((hashCode2 + ((hashCode + ((this.b.hashCode() + 527) * 31)) * 31)) * 31); } public String toString() { List c2 = c(); ArrayList arrayList = new ArrayList(d0.t.o.collectionSizeOrDefault(c2, 10)); for (Certificate certificate : c2) { arrayList.add(b(certificate)); } String obj = arrayList.toString(); StringBuilder P = c.d.b.a.a.P("Handshake{", "tlsVersion="); P.append(this.b); P.append(' '); P.append("cipherSuite="); P.append(this.f2773c); P.append(' '); P.append("peerCertificates="); P.append(obj); P.append(' '); P.append("localCertificates="); List list = this.d; ArrayList arrayList2 = new ArrayList(d0.t.o.collectionSizeOrDefault(list, 10)); for (Certificate certificate2 : list) { arrayList2.add(b(certificate2)); } P.append(arrayList2); P.append('}'); return P.toString(); } }