package lc.mecha.security;

import java.security.KeyStore;
import java.util.Objects;

/**
 * @author Alex Leigh
 * @since mk20 (TOKYO PROTOCOL)
 */
public class CertificateKeyStore implements Cloneable {
    private final KeyStore keyStore;
    private final String password;

    public CertificateKeyStore(KeyStore keyStore, String password) {
        this.keyStore = keyStore;
        this.password = password;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        CertificateKeyStore that = (CertificateKeyStore) o;
        return Objects.equals(keyStore, that.keyStore) && Objects.equals(password, that.password);
    }

    @Override
    public String toString() {
        return "CertificateKeyStore{" +
                "keyStore=" + keyStore +
                '}';
    }

    public KeyStore getKeyStore() {
        return keyStore;
    }

    public String getPassword() {
        return password;
    }

    @Override
    public int hashCode() {
        return Objects.hash(keyStore, password);
    }

    public Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
