/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.common.io.SingleCertX509KeyManager
 *  com.l7tech.common.io.SslSocketUtil
 *  com.l7tech.gateway.common.security.keystore.SsgKeyEntry
 *  com.l7tech.gateway.common.transport.SsgConnector
 *  com.l7tech.security.prov.JceProvider
 *  com.l7tech.util.ArrayUtils
 *  com.l7tech.util.CachedCallable
 *  com.l7tech.util.ConfigFactory
 *  com.l7tech.util.ExceptionUtils
 *  com.l7tech.util.InetAddressUtil
 */
package com.l7tech.server.transport.tls;

import com.l7tech.common.io.SingleCertX509KeyManager;
import com.l7tech.common.io.SslSocketUtil;
import com.l7tech.gateway.common.security.keystore.SsgKeyEntry;
import com.l7tech.gateway.common.transport.SsgConnector;
import com.l7tech.security.prov.JceProvider;
import com.l7tech.server.transport.ListenerException;
import com.l7tech.server.transport.TransportModule;
import com.l7tech.server.transport.http.DefaultHttpCiphers;
import com.l7tech.server.transport.tls.ClientTrustingTrustManager;
import com.l7tech.server.transport.tls.b;
import com.l7tech.server.transport.tls.c;
import com.l7tech.server.transport.tls.d;
import com.l7tech.server.transport.tls.e;
import com.l7tech.util.ArrayUtils;
import com.l7tech.util.CachedCallable;
import com.l7tech.util.ConfigFactory;
import com.l7tech.util.ExceptionUtils;
import com.l7tech.util.InetAddressUtil;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketAddress;
import java.security.GeneralSecurityException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.Provider;
import java.security.UnrecoverableKeyException;
import java.security.cert.X509Certificate;
import java.util.Arrays;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import javax.net.ssl.KeyManager;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLException;
import javax.net.ssl.SSLParameters;
import javax.net.ssl.SSLServerSocket;
import javax.net.ssl.SSLServerSocketFactory;
import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSessionContext;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;

public class SsgConnectorSslHelper {
    protected static final Logger logger;
    public static final String SYSPROP_ACCEPTED_ISSUERS_CACHE_TIMEOUT;
    private static final Pattern a;
    private final TransportModule b;
    private final SsgConnector c;
    private final SSLContext d;
    private final SSLServerSocketFactory e;
    private final SSLSocketFactory f;
    private final String[] g;
    private final String[] h;
    private final boolean i;
    private static final String[] j;

    /*
     * Loose catch block
     */
    public SsgConnectorSslHelper(TransportModule transportModule, SsgConnector ssgConnector) throws ListenerException, GeneralSecurityException {
        String[] stringArray;
        Set<String> set;
        block21: {
            block23: {
                String[] stringArray2;
                block20: {
                    block19: {
                        if (transportModule == null) {
                            String[] stringArray3 = j;
                            throw new IllegalArgumentException(stringArray3[19]);
                        }
                        try {
                            if (ssgConnector == null) {
                                throw new IllegalArgumentException(j[17]);
                            }
                        }
                        catch (IOException iOException) {
                            throw SsgConnectorSslHelper.a(iOException);
                        }
                        this.b = transportModule;
                        this.c = ssgConnector;
                        set = this.getDesiredTlsVersions(this.c);
                        this.d = SsgConnectorSslHelper.a(this.c, set);
                        SsgKeyEntry ssgKeyEntry = transportModule.getKeyEntry(this.c);
                        this.d.init(this.getKeyManagers(ssgKeyEntry), this.getTrustManagers(), JceProvider.getInstance().getSecureRandom());
                        this.e = this.d.getServerSocketFactory();
                        this.f = this.d.getSocketFactory();
                        int n2 = ssgConnector.getPort();
                        String string = ssgConnector.getScheme();
                        String string2 = this.d.getProvider().getName();
                        stringArray = j;
                        logger.info(stringArray[20] + string2 + stringArray[15] + string + "/" + n2);
                        int n3 = this.getIntProperty(SsgConnector.PROP_TLS_SESSION_CACHE_SIZE, 0);
                        int n4 = this.getIntProperty(SsgConnector.PROP_TLS_SESSION_CACHE_TIMEOUT, 86400);
                        SSLSessionContext sSLSessionContext = this.d.getServerSessionContext();
                        try {
                            if (sSLSessionContext != null) {
                                sSLSessionContext.setSessionCacheSize(n3);
                                sSLSessionContext.setSessionTimeout(n4);
                            }
                        }
                        catch (IOException iOException) {
                            throw SsgConnectorSslHelper.a(iOException);
                        }
                        String string3 = ssgConnector.getProperty(SsgConnector.PROP_TLS_CIPHERLIST);
                        if (string3 == null) break block19;
                        try {
                            block22: {
                                if (string3.trim().length() < 1) break block19;
                                break block22;
                                catch (IOException iOException) {
                                    throw SsgConnectorSslHelper.a(iOException);
                                }
                            }
                            stringArray2 = a.split(string3);
                            break block20;
                        }
                        catch (IOException iOException) {
                            throw SsgConnectorSslHelper.a(iOException);
                        }
                    }
                    stringArray2 = a.split(DefaultHttpCiphers.getDefaultEnabledInboundCipherSuites());
                }
                String[] stringArray4 = stringArray2;
                this.h = ArrayUtils.intersection((String[])stringArray4, (String[])this.e.getSupportedCipherSuites());
                if (stringArray4 == null) break block21;
                if (stringArray4.length <= 0) break block21;
                break block23;
                catch (IOException iOException) {
                    throw SsgConnectorSslHelper.a(iOException);
                }
            }
            try {
                block24: {
                    if (this.h.length != 0) break block21;
                    break block24;
                    catch (IOException iOException) {
                        throw SsgConnectorSslHelper.a(iOException);
                    }
                }
                throw new ListenerException(j[10]);
            }
            catch (IOException iOException) {
                throw SsgConnectorSslHelper.a(iOException);
            }
        }
        stringArray = j;
        this.i = Boolean.valueOf(this.getStringProperty(SsgConnector.PROP_TLS_ALLOW_UNSAFE_LEGACY_RENEGOTIATION, stringArray[18]));
        try {
            this.g = this.a(this.e, set, this.h, this.c.getClientAuth(), this.useCipherSuitesOrder());
        }
        catch (IOException iOException) {
            throw new ListenerException(j[1] + ExceptionUtils.getMessage((Throwable)iOException), iOException);
        }
    }

    public SSLContext getSslContext() {
        return this.d;
    }

    public boolean useCipherSuitesOrder() {
        return this.c.getBooleanProperty(SsgConnector.PROP_TLS_USE_CIPHERLIST_ORDER);
    }

    public SSLServerSocketFactory getSslServerSocketFactory() {
        return new d(this);
    }

    public SSLSocketFactory getSocketFactory() {
        SSLSocketFactory sSLSocketFactory = this.d.getSocketFactory();
        return new e(this, sSLSocketFactory);
    }

    public SSLSocket wrapAndConfigureSocketForSsl(Socket socket, boolean bl2) throws IOException {
        int n2;
        String string;
        SocketAddress socketAddress = socket.getRemoteSocketAddress();
        try {
            string = socketAddress instanceof InetSocketAddress ? InetAddressUtil.getHost((InetSocketAddress)((InetSocketAddress)socketAddress)) : null;
        }
        catch (IOException iOException) {
            throw SsgConnectorSslHelper.a(iOException);
        }
        String string2 = string;
        try {
            n2 = socketAddress instanceof InetSocketAddress ? ((InetSocketAddress)socketAddress).getPort() : 1;
        }
        catch (IOException iOException) {
            throw SsgConnectorSslHelper.a(iOException);
        }
        int n3 = n2;
        SSLSocket sSLSocket = (SSLSocket)this.f.createSocket(socket, string2, n3, true);
        this.configureSocket(sSLSocket, bl2);
        return sSLSocket;
    }

    public void configureServerSocket(SSLServerSocket sSLServerSocket) {
        SsgConnectorSslHelper.a(sSLServerSocket, this.g, this.h, this.c.getClientAuth(), this.useCipherSuitesOrder());
    }

    public void configureSocket(SSLSocket sSLSocket, boolean bl2) {
        block6: {
            sSLSocket.setUseClientMode(bl2);
            sSLSocket.setEnabledCipherSuites(this.h);
            this.a(sSLSocket, this.useCipherSuitesOrder());
            sSLSocket.setEnabledProtocols(this.g);
            if (!bl2) {
                boolean bl3;
                SSLSocket sSLSocket2;
                int n2;
                block5: {
                    n2 = this.c.getClientAuth();
                    try {
                        if (2 != n2) break block5;
                        sSLSocket.setWantClientAuth(true);
                        break block6;
                    }
                    catch (IllegalArgumentException illegalArgumentException) {
                        throw SsgConnectorSslHelper.a(illegalArgumentException);
                    }
                }
                try {
                    sSLSocket2 = sSLSocket;
                    bl3 = 0 != n2;
                }
                catch (IllegalArgumentException illegalArgumentException) {
                    throw SsgConnectorSslHelper.a(illegalArgumentException);
                }
                sSLSocket2.setNeedClientAuth(bl3);
            }
        }
    }

    public void configureSocket(SSLSocket sSLSocket) {
        block5: {
            boolean bl2;
            SSLSocket sSLSocket2;
            int n2;
            block4: {
                sSLSocket.setEnabledCipherSuites(this.h);
                this.a(sSLSocket, this.useCipherSuitesOrder());
                sSLSocket.setEnabledProtocols(this.g);
                n2 = this.c.getClientAuth();
                try {
                    if (2 != n2) break block4;
                    sSLSocket.setWantClientAuth(true);
                    break block5;
                }
                catch (IllegalArgumentException illegalArgumentException) {
                    throw SsgConnectorSslHelper.a(illegalArgumentException);
                }
            }
            try {
                sSLSocket2 = sSLSocket;
                bl2 = 0 != n2;
            }
            catch (IllegalArgumentException illegalArgumentException) {
                throw SsgConnectorSslHelper.a(illegalArgumentException);
            }
            sSLSocket2.setNeedClientAuth(bl2);
        }
    }

    private void a(SSLSocket sSLSocket, boolean bl2) {
        SSLParameters sSLParameters = sSLSocket.getSSLParameters();
        sSLParameters.setUseCipherSuitesOrder(bl2);
        sSLSocket.setSSLParameters(sSLParameters);
    }

    public void startHandshake(SSLSocket sSLSocket) throws IOException {
        SSLSession sSLSession = sSLSocket.getSession();
        try {
            if (j[21].equals(sSLSession.getCipherSuite())) {
                throw new IOException(j[5]);
            }
        }
        catch (IOException iOException) {
            throw SsgConnectorSslHelper.a(iOException);
        }
        try {
            if (!this.i) {
                sSLSocket.setEnabledCipherSuites(new String[0]);
            }
        }
        catch (IOException iOException) {
            throw SsgConnectorSslHelper.a(iOException);
        }
    }

    public static String getTlsProtocol(SsgConnector ssgConnector) {
        String string;
        block2: {
            string = ssgConnector.getProperty(SsgConnector.PROP_TLS_PROTOCOL);
            try {
                if (string != null && string.trim().length() >= 1) break block2;
            }
            catch (IllegalArgumentException illegalArgumentException) {
                throw SsgConnectorSslHelper.a(illegalArgumentException);
            }
            string = j[2];
        }
        return string;
    }

    public SSLEngine createSSLEngine(String string, int n2) {
        SSLEngine sSLEngine;
        block7: {
            boolean bl2;
            SSLEngine sSLEngine2;
            block6: {
                SSLEngine sSLEngine3;
                try {
                    sSLEngine3 = string == null ? this.d.createSSLEngine() : this.d.createSSLEngine(string, n2);
                }
                catch (IllegalArgumentException illegalArgumentException) {
                    throw SsgConnectorSslHelper.a(illegalArgumentException);
                }
                sSLEngine = sSLEngine3;
                try {
                    sSLEngine.setEnabledCipherSuites(this.h);
                    sSLEngine.setEnabledProtocols(this.g);
                    if (2 != this.c.getClientAuth()) break block6;
                    sSLEngine.setWantClientAuth(true);
                    break block7;
                }
                catch (IllegalArgumentException illegalArgumentException) {
                    throw SsgConnectorSslHelper.a(illegalArgumentException);
                }
            }
            try {
                sSLEngine2 = sSLEngine;
                bl2 = 0 != this.c.getClientAuth();
            }
            catch (IllegalArgumentException illegalArgumentException) {
                throw SsgConnectorSslHelper.a(illegalArgumentException);
            }
            sSLEngine2.setNeedClientAuth(bl2);
        }
        return new c(this, sSLEngine);
    }

    public String[] getEnabledCiphers() {
        return Arrays.copyOf(this.h, this.h.length);
    }

    public String[] getEnabledTlsVersions() {
        return Arrays.copyOf(this.g, this.g.length);
    }

    private static SSLContext a(SsgConnector ssgConnector, Set<String> set) throws NoSuchProviderException, NoSuchAlgorithmException {
        String string;
        String string2;
        block16: {
            block17: {
                string2 = SsgConnectorSslHelper.getTlsProtocol(ssgConnector);
                String string3 = ssgConnector.getProperty(SsgConnector.PROP_TLS_PROTOCOL_PROVIDER);
                try {
                    if (string3 != null) {
                        logger.log(Level.FINE, j[13] + string3);
                        return SSLContext.getInstance(string2, string3);
                    }
                }
                catch (NoSuchProviderException noSuchProviderException) {
                    throw SsgConnectorSslHelper.a(noSuchProviderException);
                }
                try {
                    if (logger.isLoggable(Level.FINE)) {
                        logger.log(Level.FINE, j[0] + String.valueOf(ssgConnector.getGoid()) + j[16] + String.valueOf(set));
                    }
                }
                catch (NoSuchProviderException noSuchProviderException) {
                    throw SsgConnectorSslHelper.a(noSuchProviderException);
                }
                string = JceProvider.SERVICE_TLS10;
                try {
                    if (set == null) break block16;
                    if (!set.contains(j[3])) break block17;
                }
                catch (NoSuchProviderException noSuchProviderException) {
                    throw SsgConnectorSslHelper.a(noSuchProviderException);
                }
                string = JceProvider.SERVICE_TLS13;
                break block16;
            }
            try {
                if (!set.contains(j[22]) && !set.contains(j[4])) break block16;
            }
            catch (NoSuchProviderException noSuchProviderException) {
                throw SsgConnectorSslHelper.a(noSuchProviderException);
            }
            string = JceProvider.SERVICE_TLS12;
        }
        Provider provider = JceProvider.getInstance().getProviderFor(string);
        try {
            if (provider == null) {
                logger.log(Level.FINE, j[14]);
                return SSLContext.getInstance(string2);
            }
        }
        catch (NoSuchProviderException noSuchProviderException) {
            throw SsgConnectorSslHelper.a(noSuchProviderException);
        }
        try {
            if (logger.isLoggable(Level.FINE)) {
                logger.log(Level.FINE, j[6] + string + j[9] + provider.getName());
            }
        }
        catch (NoSuchProviderException noSuchProviderException) {
            throw SsgConnectorSslHelper.a(noSuchProviderException);
        }
        return SSLContext.getInstance(string2, provider);
    }

    protected String getStringProperty(String string, String string2) {
        String string3;
        String string4 = this.c.getProperty(string);
        try {
            string3 = string4 != null ? string4 : string2;
        }
        catch (IllegalArgumentException illegalArgumentException) {
            throw SsgConnectorSslHelper.a(illegalArgumentException);
        }
        return string3;
    }

    protected int getIntProperty(String string, int n2) {
        try {
            return Integer.parseInt(this.getStringProperty(string, Integer.toString(n2)));
        }
        catch (NumberFormatException numberFormatException) {
            String[] stringArray = j;
            logger.warning(stringArray[23] + String.valueOf(this.c.getGoid()) + stringArray[24] + string);
            return n2;
        }
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     * Loose catch block
     * Enabled aggressive block sorting
     * Enabled unnecessary exception pruning
     * Enabled aggressive exception aggregation
     */
    private String[] a(SSLServerSocketFactory sSLServerSocketFactory, Set<String> set, String[] stringArray, int n2, boolean bl2) throws IOException {
        SSLServerSocket sSLServerSocket = (SSLServerSocket)sSLServerSocketFactory.createServerSocket();
        String[] stringArray2 = ArrayUtils.intersection((String[])set.toArray(new String[set.size()]), (String[])sSLServerSocket.getSupportedProtocols());
        SsgConnectorSslHelper.a(sSLServerSocket, stringArray2, stringArray, n2, bl2);
        try {
            sSLServerSocket.setSoTimeout(1);
            sSLServerSocket.accept();
        }
        catch (SSLException sSLException) {
            try {
                this.b.reportMisconfiguredConnector(this.c.getGoid());
                throw new IOException(sSLException);
                catch (Exception exception) {}
            }
            catch (Throwable throwable) {
                try {
                    if (sSLServerSocket.isClosed()) throw throwable;
                    sSLServerSocket.close();
                    throw throwable;
                }
                catch (SSLException sSLException2) {
                    throw SsgConnectorSslHelper.a(sSLException2);
                }
            }
            {
                try {
                    if (sSLServerSocket.isClosed()) return stringArray2;
                    sSLServerSocket.close();
                    return stringArray2;
                }
                catch (SSLException sSLException3) {
                    throw SsgConnectorSslHelper.a(sSLException3);
                }
            }
        }
        if (sSLServerSocket.isClosed()) return stringArray2;
        sSLServerSocket.close();
        return stringArray2;
    }

    private static void a(SSLServerSocket sSLServerSocket, String[] stringArray, String[] stringArray2, int n2, boolean bl2) {
        block5: {
            boolean bl3;
            SSLServerSocket sSLServerSocket2;
            block4: {
                sSLServerSocket.setEnabledCipherSuites(stringArray2);
                SSLParameters sSLParameters = sSLServerSocket.getSSLParameters();
                try {
                    sSLParameters.setUseCipherSuitesOrder(bl2);
                    sSLServerSocket.setSSLParameters(sSLParameters);
                    sSLServerSocket.setEnabledProtocols(stringArray);
                    if (2 != n2) break block4;
                    sSLServerSocket.setWantClientAuth(true);
                    break block5;
                }
                catch (IllegalArgumentException illegalArgumentException) {
                    throw SsgConnectorSslHelper.a(illegalArgumentException);
                }
            }
            try {
                sSLServerSocket2 = sSLServerSocket;
                bl3 = 0 != n2;
            }
            catch (IllegalArgumentException illegalArgumentException) {
                throw SsgConnectorSslHelper.a(illegalArgumentException);
            }
            sSLServerSocket2.setNeedClientAuth(bl3);
        }
    }

    public String[] getEnabledProtocols() {
        return this.g;
    }

    public KeyManager[] getKeyManagers() throws ListenerException, UnrecoverableKeyException {
        return this.getKeyManagers(this.b.getKeyEntry(this.c));
    }

    public KeyManager[] getKeyManagers(SsgKeyEntry ssgKeyEntry) throws UnrecoverableKeyException {
        return new KeyManager[]{new SingleCertX509KeyManager(ssgKeyEntry.getCertificateChain(), ssgKeyEntry.getPrivateKey())};
    }

    public TrustManager[] getTrustManagers() {
        ClientTrustingTrustManager clientTrustingTrustManager;
        String string = ClientTrustingTrustManager.getConfiguredIssuerCerts(this.b.getServerConfig());
        if (string != null) {
            clientTrustingTrustManager = new ClientTrustingTrustManager(ClientTrustingTrustManager.parseIssuerCerts(string));
        } else {
            long l2 = ConfigFactory.getLongProperty((String)j[12], (long)79103L);
            clientTrustingTrustManager = new ClientTrustingTrustManager((Callable<X509Certificate[]>)new CachedCallable(l2, (Callable)new b(this)));
        }
        clientTrustingTrustManager.getAcceptedIssuers();
        return new TrustManager[]{clientTrustingTrustManager};
    }

    protected Set<String> getDesiredTlsVersions(SsgConnector ssgConnector) {
        Set set;
        String string;
        block6: {
            block5: {
                String string2 = ssgConnector.getProperty(SsgConnector.PROP_TLS_OVERRIDE_PROTOCOLS);
                try {
                    if (string2 == null || string2.trim().length() <= 0) break block5;
                }
                catch (IllegalArgumentException illegalArgumentException) {
                    throw SsgConnectorSslHelper.a(illegalArgumentException);
                }
                string = string2;
                break block6;
            }
            string = ssgConnector.getProperty(SsgConnector.PROP_TLS_PROTOCOLS);
            if (string == null) {
                string = j[7];
            }
        }
        String[] stringArray = SslSocketUtil.filterSelectedTLSVersion((String)string, (Set)SslSocketUtil.DEFAULT_SUPPORTED_TLS_VERSIONS);
        try {
            set = stringArray.length == 0 ? SslSocketUtil.DEFAULT_SUPPORTED_TLS_VERSIONS : Arrays.stream(stringArray).collect(Collectors.toSet());
        }
        catch (IllegalArgumentException illegalArgumentException) {
            throw SsgConnectorSslHelper.a(illegalArgumentException);
        }
        return set;
    }

    /*
     * Unable to fully structure code
     */
    static {
        block10: {
            block9: {
                var5 = new String[25];
                var3_1 = 0;
                var2_2 = "?Wz,Nd\u001e\u0013J4A)Vu GbJ\bW4-[b\u0004\\T}1_b\u0004\\H{0_'\u001d\u0015L|b_o\u000f\\Kd'Hn\f\u0015]pbxT&\\[{,Mn\r\tJu6Bh\u0004F\u0018\u0003(tG\u0007(tG4\u001a)Y\u0007(tG4\u001a)XL/kXbCf\u0004\u0018K|#@bJ\u001aY}.NcD\\{}2Cb\u0018\\Ka+_bJ\u0015V4\u0011xKJ\u000f]g1Bh\u0004\\QgbxT&#vA\u000egX=5l\\\u001deR&0gZ\u0017gK&=L`'Fw\u001e\u0015Vsb_hJ\u001fJq#_bJ/kX\u0001Di\u001e\u0019@`b^t\u0003\u0012_4\u0007(tG4\u001a)X4\u001fWylG0\u001e\u0019[|l_u\u000b\u0012Kd-YsD\bTglJd\t\u0019H`'ON\u0019\u000fMq0XD\u000b\u001fPq\u0016Bj\u000f\u0013M`\u0010\\Hf-]n\u000e\u0019J4,Jj\u000f\u0018\u0018\u0090)Vu GbJ\bW4-[b\u0004\\T}1_b\u0004\\H{0_'\u001d\u0015L|b_o\u000f\\Kd'Hn\f\u0015]pbxT&\\[{,Mn\r\tJu6Bh\u0004F\u0018Z-EbJ\u0013^46CbJ\u000f]x'Hs\u000f\u0018\u0018w+[o\u000f\u000e\u0018g7Bs\u000f\u000f\u0018u0N'\u0019\tHd-Ys\u000f\u0018\u0018v;\u000bs\u0002\u0019\u0018a,Ob\u0018\u0010A},L'>0k42Yh\u001c\u0015\\q0\u0007 K>nwt@4\u001fWylG0\u001e\u0019[|l_u\u000b\u0012Kd-YsD\bTglJd\t\u0019H`'ON\u0019\u000fMq0XD\u000b\u001fPq\u0016Bj\u000f\u0013M`<=L`'Fw\u001e\u0015Vsb_hJ\u001fJq#_bJ/kX\u0001Di\u001e\u0019@`b^t\u0003\u0012_4!^t\u001e\u0013U42Yh\u001c\u0015\\q0\u000bi\u000b\u0011]pb6=L`'Fw\u001e\u0015Vsb_hJ\u001fJq#_bJ/kX\u0001Di\u001e\u0019@`b^t\u0003\u0012_4&Na\u000b\tT`b[u\u0005\nQp'Y\u0011\\^{0\u000bk\u0003\u000fLq,\u000bw\u0005\u000eL4\u000f\\lX\u0011\u000bq\u000f\u000eK}-EtP\\\u001b\u001dV4\u0011X`)\u0013Vz'Hs\u0005\u000e\u0018}1\u000bu\u000f\rM}0Nc\u0005\u001aYx1N\u001b\bJu,Xw\u0005\u000eLY-Or\u0006\u0019\u0018}1\u000bu\u000f\rM}0Nc\u0013)K},L'>0k42Yh\u001c\u0015\\q0\u000b\u0017/kX\u001deR&0gC\u000b\u007fO52mX\u000etI?0t\u0007(tG4\u001a)[";
                var4_3 = "?Wz,Nd\u001e\u0013J4A)Vu GbJ\bW4-[b\u0004\\T}1_b\u0004\\H{0_'\u001d\u0015L|b_o\u000f\\Kd'Hn\f\u0015]pbxT&\\[{,Mn\r\tJu6Bh\u0004F\u0018\u0003(tG\u0007(tG4\u001a)Y\u0007(tG4\u001a)XL/kXbCf\u0004\u0018K|#@bJ\u001aY}.NcD\\{}2Cb\u0018\\Ka+_bJ\u0015V4\u0011xKJ\u000f]g1Bh\u0004\\QgbxT&#vA\u000egX=5l\\\u001deR&0gZ\u0017gK&=L`'Fw\u001e\u0015Vsb_hJ\u001fJq#_bJ/kX\u0001Di\u001e\u0019@`b^t\u0003\u0012_4\u0007(tG4\u001a)X4\u001fWylG0\u001e\u0019[|l_u\u000b\u0012Kd-YsD\bTglJd\t\u0019H`'ON\u0019\u000fMq0XD\u000b\u001fPq\u0016Bj\u000f\u0013M`\u0010\\Hf-]n\u000e\u0019J4,Jj\u000f\u0018\u0018\u0090)Vu GbJ\bW4-[b\u0004\\T}1_b\u0004\\H{0_'\u001d\u0015L|b_o\u000f\\Kd'Hn\f\u0015]pbxT&\\[{,Mn\r\tJu6Bh\u0004F\u0018Z-EbJ\u0013^46CbJ\u000f]x'Hs\u000f\u0018\u0018w+[o\u000f\u000e\u0018g7Bs\u000f\u000f\u0018u0N'\u0019\tHd-Ys\u000f\u0018\u0018v;\u000bs\u0002\u0019\u0018a,Ob\u0018\u0010A},L'>0k42Yh\u001c\u0015\\q0\u0007 K>nwt@4\u001fWylG0\u001e\u0019[|l_u\u000b\u0012Kd-YsD\bTglJd\t\u0019H`'ON\u0019\u000fMq0XD\u000b\u001fPq\u0016Bj\u000f\u0013M`<=L`'Fw\u001e\u0015Vsb_hJ\u001fJq#_bJ/kX\u0001Di\u001e\u0019@`b^t\u0003\u0012_4!^t\u001e\u0013U42Yh\u001c\u0015\\q0\u000bi\u000b\u0011]pb6=L`'Fw\u001e\u0015Vsb_hJ\u001fJq#_bJ/kX\u0001Di\u001e\u0019@`b^t\u0003\u0012_4&Na\u000b\tT`b[u\u0005\nQp'Y\u0011\\^{0\u000bk\u0003\u000fLq,\u000bw\u0005\u000eL4\u000f\\lX\u0011\u000bq\u000f\u000eK}-EtP\\\u001b\u001dV4\u0011X`)\u0013Vz'Hs\u0005\u000e\u0018}1\u000bu\u000f\rM}0Nc\u0005\u001aYx1N\u001b\bJu,Xw\u0005\u000eLY-Or\u0006\u0019\u0018}1\u000bu\u000f\rM}0Nc\u0013)K},L'>0k42Yh\u001c\u0015\\q0\u000b\u0017/kX\u001deR&0gC\u000b\u007fO52mX\u000etI?0t\u0007(tG4\u001a)[".length();
                var1_4 = 10;
                var0_5 = -1;
lbl7:
                // 2 sources

                while (true) {
                    v0 = 125;
                    v1 = ++var0_5;
                    v2 = var2_2.substring(v1, v1 + var1_4);
                    v3 = -1;
                    break block9;
                    break;
                }
lbl13:
                // 1 sources

                while (true) {
                    var5[var3_1++] = SsgConnectorSslHelper.a(v0, SsgConnectorSslHelper.a(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "\u001ev[\roE?2k\u0015\u0013xI;8kA\u001a*K>.m\u0015\u0001o\u0006%(tP\u0011cEk;vGCiI%3|V\u0017eTk2pQC\u0002g9";
                    var4_3 = "\u001ev[\roE?2k\u0015\u0013xI;8kA\u001a*K>.m\u0015\u0001o\u0006%(tP\u0011cEk;vGCiI%3|V\u0017eTk2pQC\u0002g9".length();
                    var1_4 = 53;
                    var0_5 = -1;
lbl22:
                    // 2 sources

                    while (true) {
                        v0 = 92;
                        v4 = ++var0_5;
                        v2 = var2_2.substring(v4, v4 + var1_4);
                        v3 = 0;
                        break block9;
                        break;
                    }
                    break;
                }
lbl28:
                // 1 sources

                while (true) {
                    var5[var3_1++] = SsgConnectorSslHelper.a(v0, SsgConnectorSslHelper.a(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    break block10;
                    break;
                }
            }
            switch (v3) {
                default: {
                    ** continue;
                }
                ** case 0:
lbl39:
                // 1 sources

                ** continue;
            }
        }
        SsgConnectorSslHelper.j = var5;
        SsgConnectorSslHelper.SYSPROP_ACCEPTED_ISSUERS_CACHE_TIMEOUT = SsgConnectorSslHelper.j[8];
        SsgConnectorSslHelper.logger = Logger.getLogger(SsgConnectorSslHelper.class.getName());
        SsgConnectorSslHelper.a = Pattern.compile(SsgConnectorSslHelper.j[11]);
    }

    private static Exception a(Exception exception) {
        return exception;
    }

    private static char[] a(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x17);
        }
        return cArray;
    }

    /*
     * Handled impossible loop by duplicating code
     * Enabled aggressive block sorting
     */
    private static String a(int n2, char[] cArray) {
        char[] cArray2;
        block11: {
            int n3;
            int n4;
            int n5;
            block10: {
                n5 = n2;
                cArray2 = cArray;
                n4 = cArray.length;
                n3 = 0;
                if (!true) break block10;
                n4 = n4;
                if (n4 <= n3) break block11;
            }
            do {
                n5 = n5;
                cArray2 = cArray2;
                int n6 = n3;
                cArray2[n6] = (char)(cArray2[n6] ^ (n5 ^ (switch (n3 % 7) {
                    case 0 -> 1;
                    case 1 -> 69;
                    case 2 -> 105;
                    case 3 -> 63;
                    case 4 -> 86;
                    case 5 -> 122;
                    default -> 23;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

