package 㿎.ሽ.㳳;

import java.security.cert.X509Certificate;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import javax.security.auth.x500.X500Principal;

/* renamed from: 㿎.ሽ.㳳.ῲ  reason: contains not printable characters */
/* compiled from: BasicTrustRootIndex */
public final class C2573 implements AbstractC2572 {

    /* renamed from: K  reason: contains not printable characters */
    public final Map<X500Principal, Set<X509Certificate>> f8677 = new LinkedHashMap();

    public C2573(X509Certificate... x509CertificateArr) {
        for (X509Certificate x509Certificate : x509CertificateArr) {
            X500Principal subjectX500Principal = x509Certificate.getSubjectX500Principal();
            Set<X509Certificate> set = this.f8677.get(subjectX500Principal);
            if (set == null) {
                set = new LinkedHashSet<>(1);
                this.f8677.put(subjectX500Principal, set);
            }
            set.add(x509Certificate);
        }
    }

    public boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (!(obj instanceof C2573) || !((C2573) obj).f8677.equals(this.f8677)) {
            return false;
        }
        return true;
    }

    public int hashCode() {
        return this.f8677.hashCode();
    }

    @Override // 㿎.ሽ.㳳.AbstractC2572
    /* renamed from: K  reason: contains not printable characters */
    public X509Certificate m6768(X509Certificate x509Certificate) {
        Set<X509Certificate> set = this.f8677.get(x509Certificate.getIssuerX500Principal());
        if (set == null) {
            return null;
        }
        for (X509Certificate x509Certificate2 : set) {
            try {
                x509Certificate.verify(x509Certificate2.getPublicKey());
                return x509Certificate2;
            } catch (Exception unused) {
            }
        }
        return null;
    }
}
