/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.objectmodel.FindException
 *  com.l7tech.objectmodel.Goid
 *  com.l7tech.objectmodel.UpdateException
 *  com.l7tech.security.prov.JceProvider
 *  com.l7tech.util.Charsets
 *  com.l7tech.util.ConfigFactory
 *  com.l7tech.util.ExceptionUtils
 *  com.l7tech.util.Pair
 *  com.l7tech.util.PoolByteArrayOutputStream
 *  com.l7tech.util.ResourceUtils
 *  org.jetbrains.annotations.NotNull
 */
package com.l7tech.server.security.keystore.ncipher;

import com.l7tech.objectmodel.FindException;
import com.l7tech.objectmodel.Goid;
import com.l7tech.objectmodel.UpdateException;
import com.l7tech.security.prov.JceProvider;
import com.l7tech.server.event.AdminInfo;
import com.l7tech.server.security.keystore.JdkKeyStoreBackedSsgKeyStore;
import com.l7tech.server.security.keystore.KeyAccessFilter;
import com.l7tech.server.security.keystore.KeystoreFile;
import com.l7tech.server.security.keystore.KeystoreFileManager;
import com.l7tech.server.security.keystore.SsgKeyFinder;
import com.l7tech.server.security.keystore.SsgKeyMetadataManager;
import com.l7tech.server.security.keystore.SsgKeyStore;
import com.l7tech.server.security.keystore.ncipher.NcipherKeyStoreData;
import com.l7tech.server.security.keystore.ncipher.c;
import com.l7tech.server.security.keystore.ncipher.d;
import com.l7tech.server.security.keystore.ncipher.e;
import com.l7tech.util.Charsets;
import com.l7tech.util.ConfigFactory;
import com.l7tech.util.ExceptionUtils;
import com.l7tech.util.Pair;
import com.l7tech.util.PoolByteArrayOutputStream;
import com.l7tech.util.ResourceUtils;
import java.io.ByteArrayInputStream;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jetbrains.annotations.NotNull;

public class NcipherSsgKeyStore
extends JdkKeyStoreBackedSsgKeyStore
implements SsgKeyStore {
    static final String i;
    static final String j;
    private static final Logger k;
    static final String l;
    private static final String m;
    private static final long n = 5000L;
    private static final File o;
    private final Goid p;
    private final String q;
    private final KeystoreFileManager r;
    private KeyStore s;
    private NcipherKeyStoreData t;
    private int u = -1;
    private long v = 0L;
    private boolean w = false;
    private static final String[] y;

    public NcipherSsgKeyStore(Goid goid, String string, KeystoreFileManager keystoreFileManager, KeyAccessFilter keyAccessFilter, SsgKeyMetadataManager ssgKeyMetadataManager) throws KeyStoreException {
        super(keyAccessFilter, ssgKeyMetadataManager);
        this.p = goid;
        this.q = string;
        this.r = keystoreFileManager;
    }

    /*
     * Loose catch block
     * Enabled force condition propagation
     * Lifted jumps to return sites
     */
    @NotNull
    KeystoreFile b() throws KeyStoreException {
        KeystoreFile keystoreFile;
        Goid goid;
        block11: {
            goid = this.getGoid();
            if (this.r == null) throw new KeyStoreException(y[23]);
            try {
                if (goid != null) break block11;
                throw new KeyStoreException(y[23]);
                catch (FindException findException) {
                    throw NcipherSsgKeyStore.b((Exception)((Object)findException));
                }
            }
            catch (FindException findException) {
                throw NcipherSsgKeyStore.b((Exception)((Object)findException));
            }
        }
        try {
            keystoreFile = (KeystoreFile)this.r.findByPrimaryKey(goid);
        }
        catch (FindException findException) {
            String[] stringArray = y;
            throw new KeyStoreException(stringArray[1] + this.q + stringArray[19] + ExceptionUtils.getMessage((Throwable)findException), findException);
        }
        try {
            if (keystoreFile == null) {
                throw new KeyStoreException(y[8] + String.valueOf(goid));
            }
        }
        catch (FindException findException) {
            throw NcipherSsgKeyStore.b((Exception)((Object)findException));
        }
        try {
            KeystoreFile keystoreFile2 = keystoreFile;
            if (keystoreFile2 != null) return keystoreFile2;
            NcipherSsgKeyStore.b(0);
            return keystoreFile2;
        }
        catch (FindException findException) {
            throw NcipherSsgKeyStore.b((Exception)((Object)findException));
        }
    }

    private static Set<String> a(Set<String> set, Set<String> set2) {
        LinkedHashSet<String> linkedHashSet = new LinkedHashSet<String>(set);
        linkedHashSet.removeAll(set2);
        return linkedHashSet;
    }

    private static Pair<NcipherKeyStoreData, KeyStore> a(List<String> list) throws KeyStoreException {
        Pair pair;
        block7: {
            pair = null;
            String string = null;
            Exception exception = null;
            for (String string2 : list) {
                String[] stringArray;
                try {
                    stringArray = y;
                    k.info(stringArray[31] + string2);
                    KeyStore keyStore = NcipherSsgKeyStore.a(string2);
                    if (keyStore == null) continue;
                    NcipherKeyStoreData ncipherKeyStoreData = NcipherKeyStoreData.createFromLocalDisk(string2, o);
                    pair = new Pair((Object)ncipherKeyStoreData, (Object)keyStore);
                    break;
                }
                catch (Exception exception2) {
                    stringArray = y;
                    string = stringArray[7] + string2 + stringArray[19] + ExceptionUtils.getMessage((Throwable)exception2);
                    k.log(Level.WARNING, string, exception2);
                    exception = exception2;
                }
            }
            try {
                try {
                    if (exception == null || string == null) break block7;
                }
                catch (Exception exception3) {
                    throw NcipherSsgKeyStore.b(exception3);
                }
                throw new KeyStoreException(string, exception);
            }
            catch (Exception exception4) {
                throw NcipherSsgKeyStore.b(exception4);
            }
        }
        return pair;
    }

    private static KeyStore a(String string) throws KeyStoreException {
        KeyStore keyStore = null;
        KeyStore keyStore2 = JceProvider.getInstance().getKeyStore(y[0]);
        Closeable closeable = null;
        try {
            keyStore2.load(new ByteArrayInputStream(string.getBytes(Charsets.UTF8)), null);
            Enumeration<String> enumeration = keyStore2.aliases();
            while (enumeration.hasMoreElements()) {
                String string2 = enumeration.nextElement();
                if (!keyStore2.isKeyEntry(string2)) continue;
                keyStore = keyStore2;
                break;
            }
        }
        catch (IOException iOException) {
            throw new KeyStoreException(iOException);
        }
        catch (NoSuchAlgorithmException noSuchAlgorithmException) {
            throw new KeyStoreException(noSuchAlgorithmException);
        }
        catch (CertificateException certificateException) {
            throw new KeyStoreException(certificateException);
        }
        finally {
            ResourceUtils.closeQuietly(closeable);
        }
        return keyStore;
    }

    /*
     * Loose catch block
     * Enabled aggressive block sorting
     * Enabled unnecessary exception pruning
     * Enabled aggressive exception aggregation
     */
    private static Pair<NcipherKeyStoreData, KeyStore> c() throws KeyStoreException {
        Pair pair;
        String[] stringArray = y;
        k.info(stringArray[28]);
        KeyStore keyStore = JceProvider.getInstance().getKeyStore(stringArray[32]);
        PoolByteArrayOutputStream poolByteArrayOutputStream = null;
        try {
            keyStore.load(null, null);
            poolByteArrayOutputStream = new PoolByteArrayOutputStream();
            keyStore.store((OutputStream)poolByteArrayOutputStream, null);
            String string = poolByteArrayOutputStream.toString(Charsets.UTF8);
            NcipherKeyStoreData ncipherKeyStoreData = NcipherKeyStoreData.createFromLocalDisk(string, o);
            pair = new Pair((Object)ncipherKeyStoreData, (Object)keyStore);
        }
        catch (IOException iOException) {
            try {
                throw new KeyStoreException(iOException);
                catch (NoSuchAlgorithmException noSuchAlgorithmException) {
                    throw new KeyStoreException(noSuchAlgorithmException);
                }
                catch (CertificateException certificateException) {
                    throw new KeyStoreException(certificateException);
                }
            }
            catch (Throwable throwable) {
                ResourceUtils.closeQuietly(poolByteArrayOutputStream);
                throw throwable;
            }
        }
        ResourceUtils.closeQuietly((Closeable)poolByteArrayOutputStream);
        return pair;
    }

    @Override
    public Future<Boolean> deletePrivateKeyEntry(Runnable runnable, String string) throws KeyStoreException {
        return this.mutateKeystore(runnable, new c(this, string));
    }

    private Set<String> b(String string) throws IOException, KeyStoreException {
        return NcipherKeyStoreData.createFromLocalDisk((String)string, (File)NcipherSsgKeyStore.o).fileset.keySet();
    }

    @Override
    protected String getFormat() {
        return y[14];
    }

    @Override
    protected Logger getLogger() {
        return k;
    }

    @Override
    protected char[] getEntryPassword() {
        return new char[0];
    }

    @Override
    protected synchronized KeyStore keyStore() throws KeyStoreException {
        block15: {
            try {
                if (this.s != null && System.currentTimeMillis() - this.v <= this.getRefreshTime()) break block15;
            }
            catch (FindException findException) {
                throw NcipherSsgKeyStore.b((Exception)((Object)findException));
            }
            try {
                KeystoreFile keystoreFile;
                block17: {
                    block16: {
                        try {
                            if (this.s == null || this.u != this.r.getVersion(this.getGoid())) break block16;
                        }
                        catch (FindException findException) {
                            throw NcipherSsgKeyStore.b((Exception)((Object)findException));
                        }
                        return this.s;
                    }
                    keystoreFile = (KeystoreFile)this.r.findByPrimaryKey(this.getGoid());
                    try {
                        if (keystoreFile == null) {
                            throw new KeyStoreException(y[21] + String.valueOf(this.getGoid()));
                        }
                    }
                    catch (FindException findException) {
                        throw NcipherSsgKeyStore.b((Exception)((Object)findException));
                    }
                    byte[] byArray = keystoreFile.getDatabytes();
                    try {
                        if (!keystoreFile.getFormat().equals(y[33])) {
                            throw new KeyStoreException(y[27] + this.q + y[22] + keystoreFile.getFormat() + y[12]);
                        }
                    }
                    catch (FindException findException) {
                        throw NcipherSsgKeyStore.b((Exception)((Object)findException));
                    }
                    try {
                        if (byArray == null || byArray.length < 1) break block17;
                    }
                    catch (FindException findException) {
                        throw NcipherSsgKeyStore.b((Exception)((Object)findException));
                    }
                    Pair<NcipherKeyStoreData, KeyStore> pair = this.a(byArray);
                    this.s = (KeyStore)pair.right;
                    this.u = keystoreFile.getVersion();
                    break block15;
                }
                KeystoreFile keystoreFile2 = this.r.mutateKeystoreFile(keystoreFile.getGoid(), new d(this));
                this.u = keystoreFile2.getVersion();
            }
            catch (FindException findException) {
                String[] stringArray = y;
                throw new KeyStoreException(stringArray[4] + this.q + stringArray[16] + ExceptionUtils.getMessage((Throwable)findException), findException);
            }
            catch (UpdateException updateException) {
                String[] stringArray = y;
                throw new KeyStoreException(stringArray[10] + this.q + stringArray[19] + ExceptionUtils.getMessage((Throwable)updateException), updateException);
            }
        }
        return this.s;
    }

    @Override
    protected <OUT> Future<OUT> mutateKeystore(boolean bl2, Runnable runnable, Callable<OUT> callable) throws KeyStoreException {
        return this.submitMutation(bl2, AdminInfo.find(false).wrapCallable(new e(this, runnable, callable)));
    }

    synchronized Pair<NcipherKeyStoreData, KeyStore> a(byte[] byArray) throws KeyStoreException {
        String[] stringArray = y;
        k.info(stringArray[25]);
        try {
            NcipherKeyStoreData ncipherKeyStoreData = NcipherKeyStoreData.createFromBytes(byArray);
            Set<String> set = ncipherKeyStoreData.saveFilesetToLocalDisk(o);
            ncipherKeyStoreData.commitWrittenFiles(o, set);
            KeyStore keyStore = JceProvider.getInstance().getKeyStore(stringArray[32]);
            keyStore.load(new ByteArrayInputStream(ncipherKeyStoreData.keystoreMetadata.getBytes(Charsets.UTF8)), null);
            this.v = System.currentTimeMillis();
            return new Pair((Object)ncipherKeyStoreData, (Object)keyStore);
        }
        catch (IOException iOException) {
            stringArray = y;
            throw new KeyStoreException(stringArray[24] + ExceptionUtils.getMessage((Throwable)iOException), iOException);
        }
        catch (CertificateException certificateException) {
            stringArray = y;
            throw new KeyStoreException(stringArray[20] + ExceptionUtils.getMessage((Throwable)certificateException), certificateException);
        }
        catch (NoSuchAlgorithmException noSuchAlgorithmException) {
            throw new KeyStoreException(y[20] + ExceptionUtils.getMessage((Throwable)noSuchAlgorithmException), noSuchAlgorithmException);
        }
    }

    private synchronized Pair<NcipherKeyStoreData, KeyStore> d() throws KeyStoreException {
        Pair<NcipherKeyStoreData, KeyStore> pair;
        Pair<NcipherKeyStoreData, KeyStore> pair2 = this.e();
        try {
            pair = pair2 != null ? pair2 : NcipherSsgKeyStore.c();
        }
        catch (KeyStoreException keyStoreException) {
            throw NcipherSsgKeyStore.b(keyStoreException);
        }
        return pair;
    }

    private Pair<NcipherKeyStoreData, KeyStore> e() throws KeyStoreException {
        List<String> list = new ArrayList<String>();
        list = this.b(list);
        return NcipherSsgKeyStore.a(list);
    }

    private List<String> b(List<String> list) throws KeyStoreException {
        String[] stringArray;
        block7: {
            stringArray = y;
            String string = this.b().getProperty(stringArray[11]);
            try {
                try {
                    if (string == null || string.trim().length() <= 0) break block7;
                }
                catch (KeyStoreException keyStoreException) {
                    throw NcipherSsgKeyStore.b(keyStoreException);
                }
                list.add(string);
            }
            catch (KeyStoreException keyStoreException) {
                throw NcipherSsgKeyStore.b(keyStoreException);
            }
        }
        if (list.isEmpty()) {
            TreeSet<String> treeSet;
            block8: {
                treeSet = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
                stringArray = y;
                String string = this.b().getProperty(stringArray[9]);
                try {
                    if (string == null || string.trim().length() <= 0) break block8;
                }
                catch (KeyStoreException keyStoreException) {
                    throw NcipherSsgKeyStore.b(keyStoreException);
                }
                String[] stringArray2 = string.split(y[26]);
                treeSet.addAll(Arrays.asList(stringArray2));
            }
            list = NcipherKeyStoreData.readKeystoreIdentifiersFromLocalDisk(o, treeSet);
        }
        return list;
    }

    /*
     * Loose catch block
     * Enabled aggressive block sorting
     * Enabled unnecessary exception pruning
     * Enabled aggressive exception aggregation
     */
    private synchronized byte[] a(NcipherKeyStoreData ncipherKeyStoreData, KeyStore keyStore) throws KeyStoreException {
        Object object;
        String[] stringArray = y;
        k.info(stringArray[13]);
        PoolByteArrayOutputStream poolByteArrayOutputStream = null;
        try {
            Set<String> set;
            Set<String> set2;
            String string = ncipherKeyStoreData.keystoreMetadata;
            boolean bl2 = this.w;
            try {
                this.w = false;
                set2 = bl2 ? this.b(string) : Collections.emptySet();
            }
            catch (IOException iOException) {
                throw NcipherSsgKeyStore.b(iOException);
            }
            Set<String> set3 = set2;
            poolByteArrayOutputStream = new PoolByteArrayOutputStream();
            keyStore.store((OutputStream)poolByteArrayOutputStream, null);
            String string2 = poolByteArrayOutputStream.toString(Charsets.UTF8);
            try {
                if (!string.equals(string2)) {
                    throw new KeyStoreException(y[15] + string);
                }
            }
            catch (IOException iOException) {
                throw NcipherSsgKeyStore.b(iOException);
            }
            try {
                set = bl2 ? this.b(string) : Collections.emptySet();
            }
            catch (IOException iOException) {
                throw NcipherSsgKeyStore.b(iOException);
            }
            Set<String> set4 = set;
            Set<String> set5 = NcipherSsgKeyStore.a(set3, set4);
            ncipherKeyStoreData.addDeletedFiles(set5);
            for (String string3 : set5) {
                k.info(y[29] + string3);
            }
            ncipherKeyStoreData.loadFilesetFromLocalDisk(o);
            object = ncipherKeyStoreData.toBytes();
        }
        catch (IOException iOException) {
            try {
                throw new KeyStoreException(iOException);
                catch (CertificateException certificateException) {
                    throw new KeyStoreException(certificateException);
                }
                catch (NoSuchAlgorithmException noSuchAlgorithmException) {
                    throw new KeyStoreException(noSuchAlgorithmException);
                }
            }
            catch (Throwable throwable) {
                ResourceUtils.closeQuietly(poolByteArrayOutputStream);
                throw throwable;
            }
        }
        ResourceUtils.closeQuietly((Closeable)poolByteArrayOutputStream);
        return object;
    }

    KeyStore f() {
        return this.s;
    }

    int g() {
        return this.u;
    }

    @Override
    public Goid getGoid() {
        return this.p;
    }

    @Override
    public SsgKeyFinder.SsgKeyStoreType getType() {
        return SsgKeyFinder.SsgKeyStoreType.NCIPHER_HARDWARE;
    }

    public String getName() {
        return this.q;
    }

    @Override
    public boolean isKeyExportSupported() {
        return false;
    }

    /*
     * Unable to fully structure code
     */
    static {
        block10: {
            block9: {
                var5 = new String[34];
                var3_1 = 0;
                var2_2 = "\bB.D\u001a9!Hr0[\u000007G3o&V\u001e9s\u0012ngX\u001d=7Fi&F\u0016+2\u0014dg_\u0017% \u0012n5QR82\u0012`gR\u00003>Fe&@\u0013>2\u0015dgR\u001d.s\rd>G\u00063!\u0003!)U\u001f97F*&O(@<)?\n!*Q\u00064<\u0002!bG\\y Fl2G\u0006|=\tugF\u0017(&\u0014ogZ\u00070?\u0011\u000ff)[\u00009\u0018\u0003x4@\u001d.6/e4G3o&V\u001e9s\u0012ngX\u001d=7Fi&F\u0016+2\u0014dg_\u0017% \u0012n5QR82\u0012`gR\u00003>Fe&@\u0013>2\u0015dgR\u001d.s\rd>G\u00063!\u0003!)U\u001f97F>\u0005n*\u001b\u001ek'\u0003b/\u001b\u00019!\u0010d5\u001b\u000190\u0013s.@\u000bs8\u0003x4@\u001d.6Io$]\u000246\u0014.\tW\u001b,;\u0003s\u0014G\u0015\u00176\u001fR3[\u00009\u0011\u000fo.@\u001b=?-d>G\u00063!\u0003H#43o&V\u001e9s\u0012ngX\u001d=7Fq5Q\u0017$:\u0015u.Z\u0015|=%h7\\\u0017.s\rd>G\u00063!\u0003!0]\u00064s/Eg!(ng_\u0017% \u0012n5Q-::\ndgR\u001d)=\u0002!0]\u00064s\u0001n.PR\u0011\u000ff)[\u00009\u0018\u0003x4@\u001d.6/e4K3o&V\u001e9s\u0012ng]\u001c5'\u000f`+]\b9s\u000e`5P\u0005=!\u0003!,Q\u000b/'\ts\"\u0014\u0016='\u0007!.ZR82\u0012`%U\u00019s\u0000n5\u0014\u00199*\u0015u(F\u0017|=\u0007l\"PR\u0011\u000fo.@\u001b=?-d>G\u00063!\u0003H#\u0002D(9+d5S\u001b24Fo\u0004]\u000246\u0014!,Q\u000b/'\ts\"\u0014\u0016='\u0007!!F\u001d1s\nn$U\u001e|7\u000fr,\u0014\u00063s\u0002`3U\u0010= \u0003\u0017\u000er*\u001a<?:\u0016i\"F99*5u(F\u0017\u00182\u0012`<5`1Q\u0016|8\u0003x4@\u001d.6Fl\"@\u001382\u0012`gP\u001d9 Fo(@R12\u0012b/\u0014\u0017$:\u0015u.Z\u0015|>\u0003u&P\u0013(2Fn!\u000e\u0002\\!\u0017In7@]25\u0007r3\u001b\u001917\u0007u&\u001b\u001e30\u0007m;\u0005n*\u001a\u001ek'\u0003b/\u001a\u00019!\u0010d5\u001a\u000190\u0013s.@\u000br8\u0003x4@\u001d.6Ho$]\u000246\u0014/,Y\u0016='\u0007M(W\u00130\u0003\u0007u/\u0002\\!<3o&V\u001e9s\u0012ngG\u000b20Fo\u0004]\u000246\u0014!,Q\u000b/'\ts\"\u0014\u0016='\u0007!!F\u001d1s\u0002`3U\u0010= \u0003!3[R8:\u0015j}\u0014!(ng_\u0017% \u0012n5Q-::\ndgR\u001d)=\u0002!0]\u00064s\u0001n.PR,Nd?D\u0017?'\u0003eg\u0016\u001a/>HO$]\u000246\u0014J\"M!(<\u0014d\u0003U\u0006=q]!![\u000727F#//o1U\u001e57F`5S\u000716\bu4\u0014\u0007/6\u0002!3[R0<\tjgA\u0002|8\u0003x4@\u001d.6Fg.X\u0017<3o&V\u001e9s\u0012ngG\u000b20Fo\u0004]\u000246\u0014!,Q\u000b/'\ts\"\u0014\u0016='\u0007!!F\u001d1s\u0002`3U\u0010= \u0003!3[R8:\u0015j}\u00149+d5S\u001b24Fo\u0004]\u000246\u0014!,Q\u000b/'\ts\"\u0014\u0016='\u0007!!F\u001d1s\u0002`3U\u0010= \u0003!3[R0<\u0005`+\u0014\u00165 \r\u0007:rm\u0018./yA\"`3U\u0010= \u0003!,Q\u000b|7\u0007u&\u0014\u00143!\u000b`3\u0014\u00072!\u0003b(S\u001c5)\u0003egR\u001d.s\bB.D\u001a9!Fj\"M\u0001(<\u0014dgZ\u001316\u0002!3%s\"U\u00065=\u0001!)Q\u0005|8\u0003x4@\u001d.6Fv.@\u001a5=Fo\u0004]\u000246\u0014!4Q\u0011)!\u000fu>\u0014\u00053!\ne8+`5_\u001b24Fo\u0004]\u000246\u0014!,Q\u000b|5\u000fm\"\u0014\u0013/s\u0012ngV\u0017|7\u0003m\"@\u00178s\u0005m2G\u00069!Kv.P\u0017fs\u0010\u0000h)P99*\u0015u(F\u0017\u001a:\ndN'u3Q\u001f,'\u000fo \u0014\u00063s\nn&PR:!\tlgZ15#\u000ed5\u0014\u000190\u0013s.@\u000b|$\ts+PR=s\u0016s\"Q\n5 \u0012h)SR76\u001fr3[\u00009s\u0011h3\\R\u0015\u0017F";
                var4_3 = "\bB.D\u001a9!Hr0[\u000007G3o&V\u001e9s\u0012ngX\u001d=7Fi&F\u0016+2\u0014dg_\u0017% \u0012n5QR82\u0012`gR\u00003>Fe&@\u0013>2\u0015dgR\u001d.s\rd>G\u00063!\u0003!)U\u001f97F*&O(@<)?\n!*Q\u00064<\u0002!bG\\y Fl2G\u0006|=\tugF\u0017(&\u0014ogZ\u00070?\u0011\u000ff)[\u00009\u0018\u0003x4@\u001d.6/e4G3o&V\u001e9s\u0012ngX\u001d=7Fi&F\u0016+2\u0014dg_\u0017% \u0012n5QR82\u0012`gR\u00003>Fe&@\u0013>2\u0015dgR\u001d.s\rd>G\u00063!\u0003!)U\u001f97F>\u0005n*\u001b\u001ek'\u0003b/\u001b\u00019!\u0010d5\u001b\u000190\u0013s.@\u000bs8\u0003x4@\u001d.6Io$]\u000246\u0014.\tW\u001b,;\u0003s\u0014G\u0015\u00176\u001fR3[\u00009\u0011\u000fo.@\u001b=?-d>G\u00063!\u0003H#43o&V\u001e9s\u0012ngX\u001d=7Fq5Q\u0017$:\u0015u.Z\u0015|=%h7\\\u0017.s\rd>G\u00063!\u0003!0]\u00064s/Eg!(ng_\u0017% \u0012n5Q-::\ndgR\u001d)=\u0002!0]\u00064s\u0001n.PR\u0011\u000ff)[\u00009\u0018\u0003x4@\u001d.6/e4K3o&V\u001e9s\u0012ng]\u001c5'\u000f`+]\b9s\u000e`5P\u0005=!\u0003!,Q\u000b/'\ts\"\u0014\u0016='\u0007!.ZR82\u0012`%U\u00019s\u0000n5\u0014\u00199*\u0015u(F\u0017|=\u0007l\"PR\u0011\u000fo.@\u001b=?-d>G\u00063!\u0003H#\u0002D(9+d5S\u001b24Fo\u0004]\u000246\u0014!,Q\u000b/'\ts\"\u0014\u0016='\u0007!!F\u001d1s\nn$U\u001e|7\u000fr,\u0014\u00063s\u0002`3U\u0010= \u0003\u0017\u000er*\u001a<?:\u0016i\"F99*5u(F\u0017\u00182\u0012`<5`1Q\u0016|8\u0003x4@\u001d.6Fl\"@\u001382\u0012`gP\u001d9 Fo(@R12\u0012b/\u0014\u0017$:\u0015u.Z\u0015|>\u0003u&P\u0013(2Fn!\u000e\u0002\\!\u0017In7@]25\u0007r3\u001b\u001917\u0007u&\u001b\u001e30\u0007m;\u0005n*\u001a\u001ek'\u0003b/\u001a\u00019!\u0010d5\u001a\u000190\u0013s.@\u000br8\u0003x4@\u001d.6Ho$]\u000246\u0014/,Y\u0016='\u0007M(W\u00130\u0003\u0007u/\u0002\\!<3o&V\u001e9s\u0012ngG\u000b20Fo\u0004]\u000246\u0014!,Q\u000b/'\ts\"\u0014\u0016='\u0007!!F\u001d1s\u0002`3U\u0010= \u0003!3[R8:\u0015j}\u0014!(ng_\u0017% \u0012n5Q-::\ndgR\u001d)=\u0002!0]\u00064s\u0001n.PR,Nd?D\u0017?'\u0003eg\u0016\u001a/>HO$]\u000246\u0014J\"M!(<\u0014d\u0003U\u0006=q]!![\u000727F#//o1U\u001e57F`5S\u000716\bu4\u0014\u0007/6\u0002!3[R0<\tjgA\u0002|8\u0003x4@\u001d.6Fg.X\u0017<3o&V\u001e9s\u0012ngG\u000b20Fo\u0004]\u000246\u0014!,Q\u000b/'\ts\"\u0014\u0016='\u0007!!F\u001d1s\u0002`3U\u0010= \u0003!3[R8:\u0015j}\u00149+d5S\u001b24Fo\u0004]\u000246\u0014!,Q\u000b/'\ts\"\u0014\u0016='\u0007!!F\u001d1s\u0002`3U\u0010= \u0003!3[R0<\u0005`+\u0014\u00165 \r\u0007:rm\u0018./yA\"`3U\u0010= \u0003!,Q\u000b|7\u0007u&\u0014\u00143!\u000b`3\u0014\u00072!\u0003b(S\u001c5)\u0003egR\u001d.s\bB.D\u001a9!Fj\"M\u0001(<\u0014dgZ\u001316\u0002!3%s\"U\u00065=\u0001!)Q\u0005|8\u0003x4@\u001d.6Fv.@\u001a5=Fo\u0004]\u000246\u0014!4Q\u0011)!\u000fu>\u0014\u00053!\ne8+`5_\u001b24Fo\u0004]\u000246\u0014!,Q\u000b|5\u000fm\"\u0014\u0013/s\u0012ngV\u0017|7\u0003m\"@\u00178s\u0005m2G\u00069!Kv.P\u0017fs\u0010\u0000h)P99*\u0015u(F\u0017\u001a:\ndN'u3Q\u001f,'\u000fo \u0014\u00063s\nn&PR:!\tlgZ15#\u000ed5\u0014\u000190\u0013s.@\u000b|$\ts+PR=s\u0016s\"Q\n5 \u0012h)SR76\u001fr3[\u00009s\u0011h3\\R\u0015\u0017F".length();
                var1_4 = 14;
                var0_5 = -1;
lbl7:
                // 2 sources

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

                while (true) {
                    var5[var3_1++] = NcipherSsgKeyStore.b(v0, NcipherSsgKeyStore.d(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "\tC/E\u001b8 Is1Z\u000116\u0017\u000fs+\u001b=>;\u0017h#G88+4t)G\u0016\u00193\u0013a";
                    var4_3 = "\tC/E\u001b8 Is1Z\u000116\u0017\u000fs+\u001b=>;\u0017h#G88+4t)G\u0016\u00193\u0013a".length();
                    var1_4 = 14;
                    var0_5 = -1;
lbl22:
                    // 2 sources

                    while (true) {
                        v0 = 113;
                        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++] = NcipherSsgKeyStore.b(v0, NcipherSsgKeyStore.d(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;
            }
        }
        NcipherSsgKeyStore.y = var5;
        NcipherSsgKeyStore.l = NcipherSsgKeyStore.y[14];
        NcipherSsgKeyStore.j = NcipherSsgKeyStore.y[3];
        NcipherSsgKeyStore.i = NcipherSsgKeyStore.y[6];
        NcipherSsgKeyStore.m = NcipherSsgKeyStore.y[32];
        NcipherSsgKeyStore.k = Logger.getLogger(NcipherSsgKeyStore.class.getName());
        var0_6 = NcipherSsgKeyStore.y;
        NcipherSsgKeyStore.o = new File(ConfigFactory.getProperty((String)var0_6[18], (String)var0_6[17]));
    }

    private static /* synthetic */ void b(int n2) {
        String[] stringArray = y;
        throw new IllegalStateException(String.format(stringArray[2], stringArray[5], stringArray[30]));
    }

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

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

    /*
     * Handled impossible loop by duplicating code
     * Enabled aggressive block sorting
     */
    private static String b(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 -> 22;
                    case 1 -> 113;
                    case 2 -> 55;
                    case 3 -> 68;
                    case 4 -> 2;
                    case 5 -> 44;
                    default -> 35;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

