/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.common.io.XmlUtil
 *  com.l7tech.gateway.common.audit.AssertionMessages
 *  com.l7tech.gateway.common.audit.AuditDetailMessage
 *  com.l7tech.identity.User
 *  com.l7tech.message.Message
 *  com.l7tech.policy.assertion.AssertionStatus
 *  com.l7tech.policy.assertion.PolicyAssertionException
 *  com.l7tech.policy.assertion.credential.LoginCredentials
 *  com.l7tech.policy.assertion.xmlsec.EstablishOutboundSecureConversation
 *  com.l7tech.policy.variable.NoSuchVariableException
 *  com.l7tech.util.Config
 *  com.l7tech.util.DomUtils
 *  com.l7tech.util.ExceptionUtils
 *  com.l7tech.util.HexUtils
 *  com.l7tech.util.ISO8601Date
 *  com.l7tech.util.MissingRequiredElementException
 *  com.l7tech.util.PoolByteArrayOutputStream
 *  com.l7tech.util.ResourceUtils
 *  com.l7tech.util.SoapConstants
 *  com.l7tech.util.TimeUnit
 *  com.l7tech.util.TooManyChildElementsException
 *  com.l7tech.util.ValidatedConfig
 *  com.l7tech.xml.soap.SoapUtil
 *  org.springframework.beans.factory.BeanFactory
 */
package com.l7tech.server.policy.assertion.xmlsec;

import com.l7tech.common.io.XmlUtil;
import com.l7tech.gateway.common.audit.AssertionMessages;
import com.l7tech.gateway.common.audit.AuditDetailMessage;
import com.l7tech.identity.User;
import com.l7tech.message.Message;
import com.l7tech.policy.assertion.AssertionStatus;
import com.l7tech.policy.assertion.PolicyAssertionException;
import com.l7tech.policy.assertion.credential.LoginCredentials;
import com.l7tech.policy.assertion.xmlsec.EstablishOutboundSecureConversation;
import com.l7tech.policy.variable.NoSuchVariableException;
import com.l7tech.server.identity.AuthenticationResult;
import com.l7tech.server.message.AuthenticationContext;
import com.l7tech.server.message.PolicyEnforcementContext;
import com.l7tech.server.policy.assertion.AbstractMessageTargetableServerAssertion;
import com.l7tech.server.policy.variable.ExpandVariables;
import com.l7tech.server.secureconversation.InboundSecureConversationContextManager;
import com.l7tech.server.secureconversation.OutboundSecureConversationContextManager;
import com.l7tech.server.secureconversation.SecureConversationSession;
import com.l7tech.server.secureconversation.SessionCreationException;
import com.l7tech.util.Config;
import com.l7tech.util.DomUtils;
import com.l7tech.util.ExceptionUtils;
import com.l7tech.util.HexUtils;
import com.l7tech.util.ISO8601Date;
import com.l7tech.util.MissingRequiredElementException;
import com.l7tech.util.PoolByteArrayOutputStream;
import com.l7tech.util.ResourceUtils;
import com.l7tech.util.SoapConstants;
import com.l7tech.util.TimeUnit;
import com.l7tech.util.TooManyChildElementsException;
import com.l7tech.util.ValidatedConfig;
import com.l7tech.xml.soap.SoapUtil;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.text.ParseException;
import java.util.Collection;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.springframework.beans.factory.BeanFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.xml.sax.SAXException;

public class ServerEstablishOutboundSecureConversation
extends AbstractMessageTargetableServerAssertion<EstablishOutboundSecureConversation> {
    private static final String d;
    private static final String e;
    private static final long f = 0L;
    private static final long g;
    private final Config h;
    private final String[] i;
    private final InboundSecureConversationContextManager j;
    private final OutboundSecureConversationContextManager k;
    private static final String[] l;

    public ServerEstablishOutboundSecureConversation(EstablishOutboundSecureConversation establishOutboundSecureConversation, BeanFactory beanFactory) {
        super(establishOutboundSecureConversation);
        String[] stringArray = l;
        this.h = ServerEstablishOutboundSecureConversation.a((Config)beanFactory.getBean(stringArray[16], Config.class), this.logger);
        this.i = establishOutboundSecureConversation.getVariablesUsed();
        this.j = (InboundSecureConversationContextManager)beanFactory.getBean(stringArray[11], InboundSecureConversationContextManager.class);
        this.k = (OutboundSecureConversationContextManager)beanFactory.getBean(stringArray[22], OutboundSecureConversationContextManager.class);
    }

    /*
     * Loose catch block
     */
    @Override
    protected AssertionStatus doCheckRequest(PolicyEnforcementContext policyEnforcementContext, Message message, String string, AuthenticationContext authenticationContext) throws IOException, PolicyAssertionException {
        SecureConversationSession secureConversationSession;
        int n2;
        byte[] byArray;
        byte[] byArray2;
        byte[] byArray3;
        long l2;
        long l3;
        long l4;
        Element element;
        String string2;
        String string3;
        String string4;
        User user;
        Object object2222;
        block64: {
            long l5;
            block65: {
                String[] stringArray;
                block62: {
                    long l6;
                    block63: {
                        String string5;
                        AuthenticationResult authenticationResult = authenticationContext.getLastAuthenticationResult();
                        try {
                            if (authenticationResult == null) {
                                this.logAndAudit((AuditDetailMessage)AssertionMessages.OUTBOUND_SECURE_CONVERSATION_ESTABLISHMENT_FAILURE, l[21]);
                                return AssertionStatus.AUTH_FAILED;
                            }
                        }
                        catch (NoSuchVariableException noSuchVariableException) {
                            throw ServerEstablishOutboundSecureConversation.a((Exception)((Object)noSuchVariableException));
                        }
                        LoginCredentials loginCredentials = null;
                        for (Object object2222 : authenticationContext.getCredentials()) {
                            if (!authenticationResult.matchesSecurityToken(object2222.getSecurityToken())) continue;
                            loginCredentials = object2222;
                            break;
                        }
                        try {
                            if (loginCredentials == null) {
                                this.logAndAudit((AuditDetailMessage)AssertionMessages.OUTBOUND_SECURE_CONVERSATION_ESTABLISHMENT_FAILURE, l[19]);
                                return AssertionStatus.AUTH_FAILED;
                            }
                        }
                        catch (NoSuchVariableException noSuchVariableException) {
                            throw ServerEstablishOutboundSecureConversation.a((Exception)((Object)noSuchVariableException));
                        }
                        user = authenticationResult.getUser();
                        try {
                            if (user == null) {
                                this.logAndAudit((AuditDetailMessage)AssertionMessages.OUTBOUND_SECURE_CONVERSATION_ESTABLISHMENT_FAILURE, l[18]);
                                return AssertionStatus.AUTH_FAILED;
                            }
                        }
                        catch (NoSuchVariableException noSuchVariableException) {
                            throw ServerEstablishOutboundSecureConversation.a((Exception)((Object)noSuchVariableException));
                        }
                        object2222 = policyEnforcementContext.getVariableMap(this.i, this.getAudit());
                        try {
                            string5 = ((EstablishOutboundSecureConversation)this.assertion).isAllowInboundMsgUsingSession() ? null : ExpandVariables.process(((EstablishOutboundSecureConversation)this.assertion).getServiceUrl(), object2222, this.getAudit());
                        }
                        catch (NoSuchVariableException noSuchVariableException) {
                            throw ServerEstablishOutboundSecureConversation.a((Exception)((Object)noSuchVariableException));
                        }
                        string4 = string5;
                        String string6 = ((EstablishOutboundSecureConversation)this.assertion).getSecurityContextTokenVarName();
                        try {
                            Element element2;
                            Element element3;
                            block66: {
                                Object object3;
                                block61: {
                                    object3 = policyEnforcementContext.getVariable(string6);
                                    if (object3 instanceof Element) {
                                        element3 = (Element)object3;
                                    } else {
                                        try {
                                            if (!(object3 instanceof Element[]) || ((Element[])object3).length != 1) break block61;
                                        }
                                        catch (NoSuchVariableException noSuchVariableException) {
                                            throw ServerEstablishOutboundSecureConversation.a((Exception)((Object)noSuchVariableException));
                                        }
                                        element3 = ((Element[])object3)[0];
                                    }
                                    break block66;
                                }
                                if (object3 instanceof Document) {
                                    element3 = ((Document)object3).getDocumentElement();
                                } else {
                                    String[] stringArray2 = new String[1];
                                    String[] stringArray3 = l;
                                    stringArray2[0] = stringArray3[23] + string6 + stringArray3[12];
                                    this.logAndAudit((AuditDetailMessage)AssertionMessages.OUTBOUND_SECURE_CONVERSATION_ESTABLISHMENT_FAILURE, stringArray2);
                                    return AssertionStatus.FALSIFIED;
                                }
                            }
                            string3 = this.a(element3);
                            if (string3 == null) {
                                element2 = DomUtils.findExactlyOneChildElement((Element)element3);
                                string3 = SoapConstants.WSSC_NAMESPACE2;
                            } else {
                                element2 = DomUtils.findExactlyOneChildElementByName((Element)element3, (String)string3, (String)SoapConstants.WSSC_ID_EL_NAME);
                            }
                            string2 = DomUtils.getTextValue((Element)element2);
                            element = this.b(element3);
                        }
                        catch (NoSuchVariableException noSuchVariableException) {
                            String[] stringArray4 = new String[1];
                            String[] stringArray5 = l;
                            stringArray4[0] = stringArray5[0] + string6 + stringArray5[15];
                            this.logAndAudit((AuditDetailMessage)AssertionMessages.OUTBOUND_SECURE_CONVERSATION_ESTABLISHMENT_FAILURE, stringArray4);
                            return AssertionStatus.FALSIFIED;
                        }
                        catch (MissingRequiredElementException missingRequiredElementException) {
                            String[] stringArray6 = new String[1];
                            String[] stringArray7 = l;
                            stringArray6[0] = stringArray7[1];
                            this.logAndAudit((AuditDetailMessage)AssertionMessages.OUTBOUND_SECURE_CONVERSATION_ESTABLISHMENT_FAILURE, stringArray6);
                            return AssertionStatus.FALSIFIED;
                        }
                        catch (TooManyChildElementsException tooManyChildElementsException) {
                            String[] stringArray8 = new String[1];
                            String[] stringArray9 = l;
                            stringArray8[0] = stringArray9[10];
                            this.logAndAudit((AuditDetailMessage)AssertionMessages.OUTBOUND_SECURE_CONVERSATION_ESTABLISHMENT_FAILURE, stringArray8);
                            return AssertionStatus.FALSIFIED;
                        }
                        l4 = System.currentTimeMillis();
                        String string7 = ExpandVariables.process(((EstablishOutboundSecureConversation)this.assertion).getCreationTime(), object2222, this.getAudit());
                        String string8 = ExpandVariables.process(((EstablishOutboundSecureConversation)this.assertion).getExpirationTime(), object2222, this.getAudit());
                        if (!this.a(string7)) {
                            try {
                                l3 = ISO8601Date.parse((String)string7).getTime();
                            }
                            catch (ParseException parseException) {
                                String[] stringArray10 = new String[1];
                                String[] stringArray11 = l;
                                stringArray10[0] = stringArray11[24];
                                this.logAndAudit((AuditDetailMessage)AssertionMessages.OUTBOUND_SECURE_CONVERSATION_ESTABLISHMENT_FAILURE, stringArray10);
                                return AssertionStatus.FALSIFIED;
                            }
                            if (l3 > l4) {
                                l3 = l4;
                            }
                        } else {
                            l3 = l4;
                        }
                        if (!this.a(string8)) {
                            try {
                                l2 = ISO8601Date.parse((String)string8).getTime();
                            }
                            catch (ParseException parseException) {
                                String[] stringArray12 = new String[1];
                                String[] stringArray13 = l;
                                stringArray12[0] = stringArray13[14];
                                this.logAndAudit((AuditDetailMessage)AssertionMessages.OUTBOUND_SECURE_CONVERSATION_ESTABLISHMENT_FAILURE, stringArray12);
                                return AssertionStatus.FALSIFIED;
                            }
                        } else {
                            l2 = Long.MAX_VALUE;
                        }
                        try {
                            if (l2 - l3 < 0L) {
                                this.logAndAudit((AuditDetailMessage)AssertionMessages.OUTBOUND_SECURE_CONVERSATION_ESTABLISHMENT_FAILURE, l[9]);
                                return AssertionStatus.FALSIFIED;
                            }
                        }
                        catch (NoSuchVariableException noSuchVariableException) {
                            throw ServerEstablishOutboundSecureConversation.a((Exception)((Object)noSuchVariableException));
                        }
                        stringArray = l;
                        l6 = this.h.getTimeUnitProperty(stringArray[17], TimeUnit.MINUTES.toMillis(1L));
                        if (l2 == Long.MAX_VALUE) break block62;
                        try {
                            block67: {
                                if (l2 - l6 > l3) break block63;
                                break block67;
                                catch (NoSuchVariableException noSuchVariableException) {
                                    throw ServerEstablishOutboundSecureConversation.a((Exception)((Object)noSuchVariableException));
                                }
                            }
                            this.logAndAudit((AuditDetailMessage)AssertionMessages.OUTBOUND_SECURE_CONVERSATION_ESTABLISHMENT_FAILURE, l[13]);
                            return AssertionStatus.FALSIFIED;
                        }
                        catch (NoSuchVariableException noSuchVariableException) {
                            throw ServerEstablishOutboundSecureConversation.a((Exception)((Object)noSuchVariableException));
                        }
                    }
                    l2 -= l6;
                }
                if (((EstablishOutboundSecureConversation)this.assertion).isUseSystemDefaultSessionDuration()) {
                    stringArray = l;
                    l5 = this.h.getTimeUnitProperty(stringArray[8], TimeUnit.HOURS.toMillis(2L));
                } else {
                    l5 = ((EstablishOutboundSecureConversation)this.assertion).getMaxLifetime();
                }
                if (l5 <= 0L) break block64;
                try {
                    block68: {
                        if (l2 == l3) break block65;
                        break block68;
                        catch (NoSuchVariableException noSuchVariableException) {
                            throw ServerEstablishOutboundSecureConversation.a((Exception)((Object)noSuchVariableException));
                        }
                    }
                    if (l5 >= l2 - l3) break block64;
                }
                catch (NoSuchVariableException noSuchVariableException) {
                    throw ServerEstablishOutboundSecureConversation.a((Exception)((Object)noSuchVariableException));
                }
            }
            l2 = l3 + l5;
        }
        try {
            if (l2 < l4) {
                this.logAndAudit((AuditDetailMessage)AssertionMessages.OUTBOUND_SECURE_CONVERSATION_ESTABLISHMENT_FAILURE, l[2] + string2 + l[6]);
                return AssertionStatus.FALSIFIED;
            }
        }
        catch (NoSuchVariableException noSuchVariableException) {
            throw ServerEstablishOutboundSecureConversation.a((Exception)((Object)noSuchVariableException));
        }
        String string9 = ExpandVariables.process(((EstablishOutboundSecureConversation)this.assertion).getFullKey(), object2222, this.getAudit());
        String string10 = ExpandVariables.process(((EstablishOutboundSecureConversation)this.assertion).getClientEntropy(), object2222, this.getAudit());
        String string11 = ExpandVariables.process(((EstablishOutboundSecureConversation)this.assertion).getServerEntropy(), object2222, this.getAudit());
        String string12 = ExpandVariables.process(((EstablishOutboundSecureConversation)this.assertion).getKeySize(), object2222, this.getAudit());
        try {
            byArray3 = this.a(string9) ? null : HexUtils.decodeBase64((String)string9);
        }
        catch (NoSuchVariableException noSuchVariableException) {
            throw ServerEstablishOutboundSecureConversation.a((Exception)((Object)noSuchVariableException));
        }
        byte[] byArray4 = byArray3;
        try {
            byArray2 = this.a(string10) ? null : HexUtils.decodeBase64((String)string10);
        }
        catch (NoSuchVariableException noSuchVariableException) {
            throw ServerEstablishOutboundSecureConversation.a((Exception)((Object)noSuchVariableException));
        }
        byte[] byArray5 = byArray2;
        try {
            byArray = this.a(string11) ? null : HexUtils.decodeBase64((String)string11);
        }
        catch (NoSuchVariableException noSuchVariableException) {
            throw ServerEstablishOutboundSecureConversation.a((Exception)((Object)noSuchVariableException));
        }
        byte[] byArray6 = byArray;
        try {
            int n3;
            try {
                n3 = string12.isEmpty() ? 0 : Integer.parseInt(string12);
            }
            catch (NoSuchVariableException noSuchVariableException) {
                throw ServerEstablishOutboundSecureConversation.a((Exception)((Object)noSuchVariableException));
            }
            n2 = n3;
        }
        catch (NumberFormatException numberFormatException) {
            this.logAndAudit((AuditDetailMessage)AssertionMessages.OUTBOUND_SECURE_CONVERSATION_ESTABLISHMENT_FAILURE, l[5] + string12);
            return AssertionStatus.FALSIFIED;
        }
        try {
            secureConversationSession = ((EstablishOutboundSecureConversation)this.assertion).isAllowInboundMsgUsingSession() ? this.j.createContextForUser(user, string2, string3, string2, l3, l2, byArray4, byArray5, byArray6, n2, element) : this.k.createContextForUser(user, OutboundSecureConversationContextManager.newSessionKey(user, string4), string3, string2, l3, l2, byArray4, byArray5, byArray6, n2, element);
        }
        catch (SessionCreationException sessionCreationException) {
            this.logAndAudit((AuditDetailMessage)AssertionMessages.OUTBOUND_SECURE_CONVERSATION_ESTABLISHMENT_FAILURE, sessionCreationException.getMessage());
            return AssertionStatus.FALSIFIED;
        }
        policyEnforcementContext.setVariable(EstablishOutboundSecureConversation.VARIABLE_SESSION, secureConversationSession);
        return AssertionStatus.NONE;
    }

    private boolean a(String string) {
        boolean bl2;
        block5: {
            block4: {
                try {
                    try {
                        if (string != null && !string.trim().isEmpty()) break block4;
                    }
                    catch (NumberFormatException numberFormatException) {
                        throw ServerEstablishOutboundSecureConversation.a(numberFormatException);
                    }
                    bl2 = true;
                    break block5;
                }
                catch (NumberFormatException numberFormatException) {
                    throw ServerEstablishOutboundSecureConversation.a(numberFormatException);
                }
            }
            bl2 = false;
        }
        return bl2;
    }

    private static Config a(Config config, Logger logger) {
        ValidatedConfig validatedConfig = new ValidatedConfig(config, logger);
        String[] stringArray = l;
        validatedConfig.setMinimumValue(stringArray[7], (Number)60000L);
        validatedConfig.setMaximumValue(stringArray[8], (Number)86400000L);
        validatedConfig.setMinimumValue(stringArray[4], (Number)0L);
        validatedConfig.setMaximumValue(stringArray[17], (Number)g);
        return validatedConfig;
    }

    private String a(Element element) {
        Collection collection = DomUtils.findAllNamespaces((Element)element).values();
        for (String string : SoapConstants.WSSC_NAMESPACE_ARRAY) {
            try {
                if (!collection.contains(string)) continue;
                return string;
            }
            catch (NumberFormatException numberFormatException) {
                throw ServerEstablishOutboundSecureConversation.a(numberFormatException);
            }
        }
        return null;
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     * Loose catch block
     */
    private Element b(Element element) {
        Element element2 = null;
        PoolByteArrayOutputStream poolByteArrayOutputStream = null;
        InputStream inputStream = null;
        try {
            poolByteArrayOutputStream = new PoolByteArrayOutputStream(2048);
            XmlUtil.canonicalize((Node)element, (OutputStream)poolByteArrayOutputStream);
            inputStream = poolByteArrayOutputStream.toInputStream();
            element2 = XmlUtil.parse((InputStream)inputStream).getDocumentElement();
            for (String string : SoapUtil.WSU_URIS) {
                element2.removeAttributeNS(string, SoapUtil.ID_ATTRIBUTE_NAME);
            }
        }
        catch (IOException iOException) {
            String[] stringArray = l;
            this.logger.log(Level.WARNING, stringArray[20] + ExceptionUtils.getMessage((Throwable)iOException) + "'", ExceptionUtils.getDebugException((Throwable)iOException));
            ResourceUtils.closeQuietly((Closeable)inputStream);
            ResourceUtils.closeQuietly((Closeable)poolByteArrayOutputStream);
        }
        catch (SAXException sAXException) {
            this.logger.log(Level.WARNING, l[3] + ExceptionUtils.getMessage((Throwable)sAXException) + "'", ExceptionUtils.getDebugException((Throwable)sAXException));
            {
                catch (Throwable throwable) {
                    ResourceUtils.closeQuietly(inputStream);
                    ResourceUtils.closeQuietly((Closeable)poolByteArrayOutputStream);
                    throw throwable;
                }
            }
            ResourceUtils.closeQuietly((Closeable)inputStream);
            ResourceUtils.closeQuietly((Closeable)poolByteArrayOutputStream);
        }
        ResourceUtils.closeQuietly((Closeable)inputStream);
        ResourceUtils.closeQuietly((Closeable)poolByteArrayOutputStream);
        return element2;
    }

    /*
     * Unable to fully structure code
     */
    static {
        block10: {
            block9: {
                var5 = new String[25];
                var3_1 = 0;
                var2_2 = "=eE\u0014h%\b\u001c\u007fI@b`\b\u0006cTQc4K\u001dbKQu`\u001d\b\u007fIUy,\u000eI%nUv%QI/E=eE\u0014h%\b\u001c\u007fI@b`\b\u0006cTQc4K\u001dbKQu`\u000f\u0006hS\u0014u/\u001fInOZo!\u0002\u0007-AZb`W iEZo)\r\u0000hR\n;%\u0007\f`EZon\u0011=eE\u0014h%\u0018\u001adOZ;h\"-7\u0000*<cAVw%K\u001db\u0000Wi%\n\u001dh\u0000P~4\n\u001dnHQ\u007f`\b\u0006cTQc4K\u001dbKQu`L/\u0006xTVt5\u0005\r#SQx5\u0019\fNOZm%\u0019\u001alT]t.E\u001ahSGr/\u00059\u007fEqc0\u0002\u001btaS~\u0012 cVUw)\u000fIfEM;3\u0002\u0013h\u001a\u0014\u000e@-HUh`\u000e\u0011}IF~$E2\u0006xTVt5\u0005\r#SQx5\u0019\fNOZm%\u0019\u001alT]t.E\rhFUn,\u001f:hSGr/\u0005-xRUo)\u0004\u00072\u0006xTVt5\u0005\r#SQx5\u0019\fNOZm%\u0019\u001alT]t.E\rhFUn,\u001f:hSGr/\u0005-xRUo)\u0004\u0007V cVUw)\u000fI^EGh)\u0004\u0007-t]v%QIyHQ;3\u000e\u001a~I[u`\u000e\u0011}IFz4\u0002\u0006c\u0000@r-\u000eIdS\u0014y%\r\u0006\u007fE\u0014o(\u000eI~EGh)\u0004\u0007-CF~!\u001f\u0000bN\u0014o)\u0006\f#B=eE\u0014h%\b\u001c\u007fI@b`\b\u0006cTQc4K\u001dbKQu`\u0003\b~\u0000Yt2\u000eIyHUu`\u0004\u0007h\u0000\bR$\u000e\u0007yIRr%\u0019W-EX~-\u000e\u0007y\u000e'\u0000cB[n.\u000f:hCAi%(\u0006cVQi3\n\u001ddOZX/\u0005\u001dhX@V!\u0005\bjEF\u001dK$\u0000]h`\u0004\u000f-AZ;5\u0005\u001axPDt2\u001f\fi\u0000@b0\u000eG0:hSGr/\u0005I}RQ6%\u0013\u0019dRM;!\f\f-ELx%\u000e\r~\u0000G~3\u0018\u0000bN\u0014w)\r\fyIY~n'=eE\u0014h%\u0018\u001adOZ;%\u0013\u0019dRUo)\u0004\u0007-T]v%K\u0000~\u0000]u6\n\u0005dD\u001a\u0012K$\u0000Pt%\u0018IcO@;%\u0013\u0000~T\u001a\f\u001ahRB~2(\u0006cF]|/\u0006xTVt5\u0005\r#SQx5\u0019\fNOZm%\u0019\u001alT]t.E\u001ahSGr/\u00059\u007fEqc0\u0002\u001btaS~2'b\u0000Un4\u0003\fcT]x!\u001f\fi\u0000Ah%\u0019IkOAu$K\u0000c\u0000@s%K\u001dlRS~4K\u0004hSGz'\u000eG1*\u007fEP~.\u001f\u0000lLG;.\u0004\u001d-F[n.\u000fIkOF;4\u0003\f-AAo(\u000e\u0007yIWz4\u000e\r-UG~2E*<cAVw%K\u001db\u0000Wi%\n\u001dh\u0000P~4\n\u001dnHQ\u007f`\b\u0006cTQc4K\u001dbKQu`LC=eE\u0014o!\u0019\u000ehT\u0014v%\u0018\u001alGQ;$\u0004\f~\u0000Zt4K\nbN@z)\u0005IlNM;!\u001e\u001deEZo)\b\byI[u`\u0002\u0007kOFv!\u001f\u0000bN\u001a(\u0006xTVt5\u0005\r^EWn2\u000e*bNB~2\u0018\byI[u\u0003\u0004\u0007yELo\r\n\u0007lGQi";
                var4_3 = "=eE\u0014h%\b\u001c\u007fI@b`\b\u0006cTQc4K\u001dbKQu`\u001d\b\u007fIUy,\u000eI%nUv%QI/E=eE\u0014h%\b\u001c\u007fI@b`\b\u0006cTQc4K\u001dbKQu`\u000f\u0006hS\u0014u/\u001fInOZo!\u0002\u0007-AZb`W iEZo)\r\u0000hR\n;%\u0007\f`EZon\u0011=eE\u0014h%\u0018\u001adOZ;h\"-7\u0000*<cAVw%K\u001db\u0000Wi%\n\u001dh\u0000P~4\n\u001dnHQ\u007f`\b\u0006cTQc4K\u001dbKQu`L/\u0006xTVt5\u0005\r#SQx5\u0019\fNOZm%\u0019\u001alT]t.E\u001ahSGr/\u00059\u007fEqc0\u0002\u001btaS~\u0012 cVUw)\u000fIfEM;3\u0002\u0013h\u001a\u0014\u000e@-HUh`\u000e\u0011}IF~$E2\u0006xTVt5\u0005\r#SQx5\u0019\fNOZm%\u0019\u001alT]t.E\rhFUn,\u001f:hSGr/\u0005-xRUo)\u0004\u00072\u0006xTVt5\u0005\r#SQx5\u0019\fNOZm%\u0019\u001alT]t.E\rhFUn,\u001f:hSGr/\u0005-xRUo)\u0004\u0007V cVUw)\u000fI^EGh)\u0004\u0007-t]v%QIyHQ;3\u000e\u001a~I[u`\u000e\u0011}IFz4\u0002\u0006c\u0000@r-\u000eIdS\u0014y%\r\u0006\u007fE\u0014o(\u000eI~EGh)\u0004\u0007-CF~!\u001f\u0000bN\u0014o)\u0006\f#B=eE\u0014h%\b\u001c\u007fI@b`\b\u0006cTQc4K\u001dbKQu`\u0003\b~\u0000Yt2\u000eIyHUu`\u0004\u0007h\u0000\bR$\u000e\u0007yIRr%\u0019W-EX~-\u000e\u0007y\u000e'\u0000cB[n.\u000f:hCAi%(\u0006cVQi3\n\u001ddOZX/\u0005\u001dhX@V!\u0005\bjEF\u001dK$\u0000]h`\u0004\u000f-AZ;5\u0005\u001axPDt2\u001f\fi\u0000@b0\u000eG0:hSGr/\u0005I}RQ6%\u0013\u0019dRM;!\f\f-ELx%\u000e\r~\u0000G~3\u0018\u0000bN\u0014w)\r\fyIY~n'=eE\u0014h%\u0018\u001adOZ;%\u0013\u0019dRUo)\u0004\u0007-T]v%K\u0000~\u0000]u6\n\u0005dD\u001a\u0012K$\u0000Pt%\u0018IcO@;%\u0013\u0000~T\u001a\f\u001ahRB~2(\u0006cF]|/\u0006xTVt5\u0005\r#SQx5\u0019\fNOZm%\u0019\u001alT]t.E\u001ahSGr/\u00059\u007fEqc0\u0002\u001btaS~2'b\u0000Un4\u0003\fcT]x!\u001f\fi\u0000Ah%\u0019IkOAu$K\u0000c\u0000@s%K\u001dlRS~4K\u0004hSGz'\u000eG1*\u007fEP~.\u001f\u0000lLG;.\u0004\u001d-F[n.\u000fIkOF;4\u0003\f-AAo(\u000e\u0007yIWz4\u000e\r-UG~2E*<cAVw%K\u001db\u0000Wi%\n\u001dh\u0000P~4\n\u001dnHQ\u007f`\b\u0006cTQc4K\u001dbKQu`LC=eE\u0014o!\u0019\u000ehT\u0014v%\u0018\u001alGQ;$\u0004\f~\u0000Zt4K\nbN@z)\u0005IlNM;!\u001e\u001deEZo)\b\byI[u`\u0002\u0007kOFv!\u001f\u0000bN\u001a(\u0006xTVt5\u0005\r^EWn2\u000e*bNB~2\u0018\byI[u\u0003\u0004\u0007yELo\r\n\u0007lGQi".length();
                var1_4 = 44;
                var0_5 = -1;
lbl7:
                // 2 sources

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

                while (true) {
                    var5[var3_1++] = ServerEstablishOutboundSecureConversation.c(v0, ServerEstablishOutboundSecureConversation.b(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "\u000eVv'[\u0016;/LzsQS;5PgbP\u0007x.QxbFS.;LzfJ\u001f=z\u0016]fE\u0016bz\u001c%\u000eVv'[\u0016+)W|i\b\u0010*?_gnG\u001dx.W~b\b\u001a+zW}qI\u001f1>\u0010";
                    var4_3 = "\u000eVv'[\u0016;/LzsQS;5PgbP\u0007x.QxbFS.;LzfJ\u001f=z\u0016]fE\u0016bz\u001c%\u000eVv'[\u0016+)W|i\b\u0010*?_gnG\u001dx.W~b\b\u001a+zW}qI\u001f1>\u0010".length();
                    var1_4 = 44;
                    var0_5 = -1;
lbl22:
                    // 2 sources

                    while (true) {
                        v0 = 116;
                        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++] = ServerEstablishOutboundSecureConversation.c(v0, ServerEstablishOutboundSecureConversation.b(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;
            }
        }
        ServerEstablishOutboundSecureConversation.l = var5;
        ServerEstablishOutboundSecureConversation.d = ServerEstablishOutboundSecureConversation.l[8];
        ServerEstablishOutboundSecureConversation.e = ServerEstablishOutboundSecureConversation.l[17];
        ServerEstablishOutboundSecureConversation.g = TimeUnit.HOURS.toMillis(2L);
    }

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

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

    /*
     * Handled impossible loop by duplicating code
     * Enabled aggressive block sorting
     */
    private static String c(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 -> 46;
                    case 1 -> 74;
                    case 2 -> 103;
                    case 3 -> 115;
                    case 4 -> 92;
                    case 5 -> 7;
                    default -> 44;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

