package XnFJ5_9.Ft6VRog_36.KNBe_11;

import XnFJ5_9.XuVgy_28;
import java.security.NoSuchAlgorithmException;
import java.security.Provider;
import java.util.List;
import javax.annotation.Nullable;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import org.conscrypt.Conscrypt;
/* compiled from: ConscryptPlatform.java */
/* loaded from: classes.dex */
public class QxJ9d_1 extends X6FRs_4 {
    @Override // XnFJ5_9.Ft6VRog_36.KNBe_11.X6FRs_4
    /* renamed from: KQgRr5e_0 */
    public final Provider mo698KQgRr5e_0() {
        return Conscrypt.newProviderBuilder().provideTrustManager().build();
    }

    @Override // XnFJ5_9.Ft6VRog_36.KNBe_11.X6FRs_4
    public void KQgRr5e_0(SSLSocket sSLSocket, String str, List<XuVgy_28> list) {
        if (Conscrypt.isConscrypt(sSLSocket)) {
            if (str != null) {
                Conscrypt.setUseSessionTickets(sSLSocket, true);
                Conscrypt.setHostname(sSLSocket, str);
            }
            Conscrypt.setApplicationProtocols(sSLSocket, (String[]) X6FRs_4.KQgRr5e_0(list).toArray(new String[0]));
            return;
        }
        super.KQgRr5e_0(sSLSocket, str, list);
    }

    @Override // XnFJ5_9.Ft6VRog_36.KNBe_11.X6FRs_4
    @Nullable
    public String KQgRr5e_0(SSLSocket sSLSocket) {
        if (Conscrypt.isConscrypt(sSLSocket)) {
            return Conscrypt.getApplicationProtocol(sSLSocket);
        }
        return super.KQgRr5e_0(sSLSocket);
    }

    @Override // XnFJ5_9.Ft6VRog_36.KNBe_11.X6FRs_4
    /* renamed from: KQgRr5e_0 */
    public SSLContext mo698KQgRr5e_0() {
        try {
            return SSLContext.getInstance("TLSv1.3", mo698KQgRr5e_0());
        } catch (NoSuchAlgorithmException e) {
            try {
                return SSLContext.getInstance("TLS", mo698KQgRr5e_0());
            } catch (NoSuchAlgorithmException unused) {
                throw new IllegalStateException("No TLS provider", e);
            }
        }
    }

    public static QxJ9d_1 KQgRr5e_0() {
        try {
            Class.forName("org.conscrypt.Conscrypt");
            if (Conscrypt.isAvailable()) {
                return new QxJ9d_1();
            }
            return null;
        } catch (ClassNotFoundException unused) {
            return null;
        }
    }

    @Override // XnFJ5_9.Ft6VRog_36.KNBe_11.X6FRs_4
    public void KQgRr5e_0(SSLSocketFactory sSLSocketFactory) {
        if (Conscrypt.isConscrypt(sSLSocketFactory)) {
            Conscrypt.setUseEngineSocket(sSLSocketFactory, true);
        }
    }
}
