package g;

import java.io.IOException;
import java.security.cert.Certificate;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
import javax.net.ssl.SSLPeerUnverifiedException;
import javax.net.ssl.SSLSession;

/* JADX INFO: loaded from: classes.dex */
public final class q {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final h0 f6433a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final g f6434b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final List<Certificate> f6435c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final List<Certificate> f6436d;

    public q(h0 h0Var, g gVar, List<Certificate> list, List<Certificate> list2) {
        this.f6433a = h0Var;
        this.f6434b = gVar;
        this.f6435c = list;
        this.f6436d = list2;
    }

    public static q a(SSLSession sSLSession) throws IOException {
        Certificate[] peerCertificates;
        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");
        }
        g gVarA = g.a(cipherSuite);
        String protocol = sSLSession.getProtocol();
        if (protocol == null) {
            throw new IllegalStateException("tlsVersion == null");
        }
        if ("NONE".equals(protocol)) {
            throw new IOException("tlsVersion == NONE");
        }
        h0 h0VarForJavaName = h0.forJavaName(protocol);
        try {
            peerCertificates = sSLSession.getPeerCertificates();
        } catch (SSLPeerUnverifiedException unused) {
            peerCertificates = null;
        }
        List listO = peerCertificates != null ? g.i0.c.o(peerCertificates) : Collections.emptyList();
        Certificate[] localCertificates = sSLSession.getLocalCertificates();
        return new q(h0VarForJavaName, gVarA, listO, localCertificates != null ? g.i0.c.o(localCertificates) : Collections.emptyList());
    }

    public boolean equals(@Nullable Object obj) {
        if (!(obj instanceof q)) {
            return false;
        }
        q qVar = (q) obj;
        return this.f6433a.equals(qVar.f6433a) && this.f6434b.equals(qVar.f6434b) && this.f6435c.equals(qVar.f6435c) && this.f6436d.equals(qVar.f6436d);
    }

    public int hashCode() {
        return this.f6436d.hashCode() + ((this.f6435c.hashCode() + ((this.f6434b.hashCode() + ((this.f6433a.hashCode() + 527) * 31)) * 31)) * 31);
    }
}
