package n9; import java.io.IOException; import java.security.cert.Certificate; import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLSession; /* loaded from: classes2.dex */ public final class w { /* renamed from: a, reason: collision with root package name */ private final j0 f12513a; /* renamed from: b, reason: collision with root package name */ private final k f12514b; /* renamed from: c, reason: collision with root package name */ private final List f12515c; /* renamed from: d, reason: collision with root package name */ private final List f12516d; private w(j0 j0Var, k kVar, List list, List list2) { this.f12513a = j0Var; this.f12514b = kVar; this.f12515c = list; this.f12516d = list2; } public static w b(SSLSession sSLSession) { Certificate[] certificateArr; String cipherSuite = sSLSession.getCipherSuite(); if (cipherSuite == null) { throw new IllegalStateException("cipherSuite == null"); } if ("SSL_NULL_WITH_NULL_NULL".equals(cipherSuite)) { throw new IOException("cipherSuite == SSL_NULL_WITH_NULL_NULL"); } k b10 = k.b(cipherSuite); String protocol = sSLSession.getProtocol(); if (protocol == null) { throw new IllegalStateException("tlsVersion == null"); } if ("NONE".equals(protocol)) { throw new IOException("tlsVersion == NONE"); } j0 a10 = j0.a(protocol); try { certificateArr = sSLSession.getPeerCertificates(); } catch (SSLPeerUnverifiedException unused) { certificateArr = null; } List u10 = certificateArr != null ? o9.e.u(certificateArr) : Collections.emptyList(); Certificate[] localCertificates = sSLSession.getLocalCertificates(); return new w(a10, b10, u10, localCertificates != null ? o9.e.u(localCertificates) : Collections.emptyList()); } private List c(List list) { ArrayList arrayList = new ArrayList(); Iterator it = list.iterator(); while (it.hasNext()) { Certificate certificate = (Certificate) it.next(); if (certificate instanceof X509Certificate) { arrayList.add(String.valueOf(((X509Certificate) certificate).getSubjectDN())); } else { arrayList.add(certificate.getType()); } } return arrayList; } public k a() { return this.f12514b; } public List d() { return this.f12515c; } public boolean equals(Object obj) { if (!(obj instanceof w)) { return false; } w wVar = (w) obj; return this.f12513a.equals(wVar.f12513a) && this.f12514b.equals(wVar.f12514b) && this.f12515c.equals(wVar.f12515c) && this.f12516d.equals(wVar.f12516d); } public int hashCode() { return ((((((527 + this.f12513a.hashCode()) * 31) + this.f12514b.hashCode()) * 31) + this.f12515c.hashCode()) * 31) + this.f12516d.hashCode(); } public String toString() { return "Handshake{tlsVersion=" + this.f12513a + " cipherSuite=" + this.f12514b + " peerCertificates=" + c(this.f12515c) + " localCertificates=" + c(this.f12516d) + '}'; } }