/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.gateway.common.security.keystore.SsgKeyEntry
 *  com.l7tech.objectmodel.ObjectModelException
 */
package com.l7tech.server.bundling;

import com.l7tech.gateway.common.security.keystore.SsgKeyEntry;
import com.l7tech.objectmodel.ObjectModelException;
import com.l7tech.server.bundling.u;
import com.l7tech.server.security.keystore.SsgKeyStore;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;

class w
implements Callable<String> {
    final SsgKeyEntry val$existingSsgKeyEntry;
    final SsgKeyEntry val$ssgKeyEntry;
    final boolean val$replaceMatchingCertChainIfRequired;
    final u this$1;
    private static final String a = w.a(55, w.a("\u001cx^\u0006$?.-~I\u0004&k&7m\f\u001d9?:)nM\u001d3?.yz^\u0000 ~;<*G\f/%o"));

    /*
     * Ignored method signature, as it can't be verified against descriptor
     */
    w(u u2, SsgKeyEntry ssgKeyEntry, SsgKeyEntry ssgKeyEntry2, boolean bl2) {
        this.this$1 = u2;
        this.val$existingSsgKeyEntry = ssgKeyEntry;
        this.val$ssgKeyEntry = ssgKeyEntry2;
        this.val$replaceMatchingCertChainIfRequired = bl2;
    }

    @Override
    public String call() throws Exception {
        SsgKeyStore ssgKeyStore = this.this$1.this$0.a(this.val$existingSsgKeyEntry.getKeystoreId());
        Future<Boolean> future = ssgKeyStore.storePrivateKeyEntry(true, null, this.val$ssgKeyEntry, true, this.val$replaceMatchingCertChainIfRequired);
        try {
            if (!future.get().booleanValue()) {
                throw new ObjectModelException(a + this.val$ssgKeyEntry.getId());
            }
        }
        catch (Exception exception) {
            throw w.a(exception);
        }
        return null;
    }

    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] ^ 0x78);
        }
        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 -> 110;
                    case 1 -> 61;
                    case 2 -> 27;
                    case 3 -> 94;
                    case 4 -> 97;
                    case 5 -> 40;
                    default -> 120;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

