/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.common.io.CertUtils
 *  com.l7tech.util.ExceptionUtils
 */
package com.l7tech.server.identity.ldap;

import com.l7tech.common.io.CertUtils;
import com.l7tech.server.identity.ldap.LdapCertificateCache;
import com.l7tech.server.identity.ldap.LdapUtils;
import com.l7tech.server.identity.ldap.c;
import com.l7tech.server.identity.ldap.k;
import com.l7tech.util.ExceptionUtils;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.logging.Level;
import javax.naming.NamingException;
import javax.naming.directory.Attributes;

class m
extends k {
    final c val$index;
    final LdapCertificateCache this$0;
    private static final String[] a;

    m(LdapCertificateCache ldapCertificateCache, c c10) {
        this.this$0 = ldapCertificateCache;
        this.val$index = c10;
    }

    @Override
    void a(String string, Attributes attributes) throws NamingException {
        for (String string2 : this.this$0.i) {
            Object object = LdapUtils.a(attributes, string2);
            if (!(object instanceof byte[])) continue;
            try {
                X509Certificate x509Certificate = CertUtils.decodeCert((byte[])((byte[])object));
                this.val$index.addCertificateToIndexes(string, x509Certificate);
            }
            catch (CertificateException certificateException) {
                String[] stringArray = a;
                LdapCertificateCache.a.log(Level.WARNING, stringArray[0] + string + stringArray[1] + ExceptionUtils.getMessage((Throwable)certificateException), ExceptionUtils.getDebugException((Throwable)certificateException));
            }
        }
    }

    /*
     * Enabled aggressive block sorting
     */
    static {
        String[] stringArray = new String[2];
        int n2 = 0;
        String string = "\u001b\u0011\tv\\].7\n\\jJ\u0012#=\r\u000f:[\u00182,\u0017\u001as[\u001c4=^\u001auJ]g\u0003\u007fD\\";
        int n3 = "\u001b\u0011\tv\\].7\n\\jJ\u0012#=\r\u000f:[\u00182,\u0017\u001as[\u001c4=^\u001auJ]g\u0003\u007fD\\".length();
        int n4 = 35;
        int n5 = -1;
        while (true) {
            int n6 = ++n5;
            stringArray[n2++] = m.a(100, m.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] ^ 0x24);
        }
        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 -> 60;
                    case 1 -> 26;
                    case 2 -> 24;
                    case 3 -> 126;
                    case 4 -> 92;
                    case 5 -> 25;
                    default -> 36;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

