/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.util.MasterPasswordManager
 */
package com.l7tech.server.util;

import com.l7tech.util.MasterPasswordManager;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

public class PropertiesDecryptor {
    private final MasterPasswordManager a;
    private String[] b;

    public PropertiesDecryptor(MasterPasswordManager masterPasswordManager) {
        this.a = masterPasswordManager;
    }

    public void setPasswordProperties(String[] stringArray) {
        this.b = stringArray;
    }

    public void decryptEncryptedPasswords(Properties properties) {
        Set<Map.Entry<Object, Object>> set = properties.entrySet();
        for (Map.Entry<Object, Object> entry : set) {
            if (!this.isPasswordPropertyName(entry.getKey()) || entry.getValue() == null) continue;
            Object object = entry.getValue();
            String string = new String(this.a.decryptPasswordIfEncrypted(object.toString()));
            entry.setValue(string);
        }
    }

    public boolean isPasswordPropertyName(Object object) {
        if (this.b == null) {
            return true;
        }
        for (String string : this.b) {
            if (!string.equals(object)) continue;
            return true;
        }
        return false;
    }
}

