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

import com.l7tech.gateway.common.security.keystore.SsgKeyEntry;
import com.l7tech.objectmodel.ObjectModelException;
import com.l7tech.server.security.keystore.JdkKeyStoreBackedSsgKeyStore;
import com.l7tech.util.ExceptionUtils;
import java.security.KeyStoreException;
import java.util.concurrent.Callable;
import java.util.logging.Level;

class a
implements Callable<Boolean> {
    final SsgKeyEntry val$entry;
    final boolean val$overwriteExisting;
    final boolean val$replaceAllMatchingCertChain;
    final JdkKeyStoreBackedSsgKeyStore this$0;
    private static final String[] a;

    /*
     * Ignored method signature, as it can't be verified against descriptor
     */
    a(JdkKeyStoreBackedSsgKeyStore jdkKeyStoreBackedSsgKeyStore, SsgKeyEntry ssgKeyEntry, boolean bl2, boolean bl3) {
        this.this$0 = jdkKeyStoreBackedSsgKeyStore;
        this.val$entry = ssgKeyEntry;
        this.val$overwriteExisting = bl2;
        this.val$replaceAllMatchingCertChain = bl3;
    }

    @Override
    public Boolean call() throws KeyStoreException {
        try {
            this.this$0.a(this.val$entry, this.val$overwriteExisting, this.val$replaceAllMatchingCertChain);
        }
        catch (Exception exception) {
            String[] stringArray = a;
            JdkKeyStoreBackedSsgKeyStore.a.log(Level.WARNING, stringArray[0] + ExceptionUtils.getMessage((Throwable)exception), exception);
            throw new KeyStoreException(stringArray[1] + ExceptionUtils.getMessage((Throwable)exception));
        }
        try {
            this.this$0.h.updateMetadataForKey(this.val$entry.getKeystoreId(), this.val$entry.getAlias(), this.val$entry.getKeyMetadata());
        }
        catch (ObjectModelException objectModelException) {
            throw new KeyStoreException(a[2] + this.val$entry.getAlias(), objectModelException);
        }
        return Boolean.TRUE;
    }

    /*
     * Enabled aggressive block sorting
     */
    static {
        String[] stringArray = new String[3];
        int n2 = 0;
        String string = "o\u0005\nG:<SN\u0004KV\"6\u0001_K\u001bW?/\u0012N\u000eKN3 S_\u0005\u001fW/uS#o\u0005\nG:<SN\u0004KV\"6\u0001_K\u001bW?/\u0012N\u000eKN3 S_\u0005\u001fW/uS\"o\u0005\nG:<SN\u0004KP&=\u0012N\u000eKH3-\u0012^\n\u001fDv?\u001cHK\u0000@/y";
        int n3 = "o\u0005\nG:<SN\u0004KV\"6\u0001_K\u001bW?/\u0012N\u000eKN3 S_\u0005\u001fW/uS#o\u0005\nG:<SN\u0004KV\"6\u0001_K\u001bW?/\u0012N\u000eKN3 S_\u0005\u001fW/uS\"o\u0005\nG:<SN\u0004KP&=\u0012N\u000eKH3-\u0012^\n\u001fDv?\u001cHK\u0000@/y".length();
        int n4 = 35;
        int n5 = -1;
        while (true) {
            int n6 = ++n5;
            stringArray[n2++] = com.l7tech.server.security.keystore.a.a(43, com.l7tech.server.security.keystore.a.a(string.substring(n6, n6 + n4)));
            if ((n5 += n4) >= n3) {
                a = stringArray;
                return;
            }
            n4 = string.charAt(n5);
        }
    }

    private static char[] a(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x58);
        }
        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 -> 17;
                    case 1 -> 64;
                    case 2 -> 64;
                    case 3 -> 14;
                    case 4 -> 125;
                    case 5 -> 114;
                    default -> 88;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

