/*
 * 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 v
implements Callable<String> {
    final SsgKeyEntry val$ssgKeyEntry;
    final boolean val$replaceMatchingCertChainIfRequired;
    final u this$1;
    private static final String a = v.a(38, v.a(")}\u0019e\u0013T\u0004\u0018{\u000eg\u0011\u0000\f\u0002hK~\u000eT\u0016\ry\u000e*\u0000T\u0015\u001ef\u001dk\u0015\u0011E\u0007j\u00120A"));

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

    @Override
    public String call() throws Exception {
        SsgKeyStore ssgKeyStore = this.this$1.this$0.a(this.val$ssgKeyEntry.getKeystoreId());
        Future<Boolean> future = ssgKeyStore.storePrivateKeyEntry(true, null, this.val$ssgKeyEntry, false, this.val$replaceMatchingCertChainIfRequired);
        try {
            if (!future.get().booleanValue()) {
                throw new ObjectModelException(a + this.val$ssgKeyEntry.getId());
            }
        }
        catch (Exception exception) {
            throw v.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] ^ 0x43);
        }
        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 -> 74;
                    case 1 -> 41;
                    case 2 -> 77;
                    case 3 -> 44;
                    case 4 -> 71;
                    case 5 -> 82;
                    default -> 67;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

