package o; import java.io.IOException; import java.math.BigInteger; import java.security.MessageDigest; import java.security.cert.CertSelector; import java.security.cert.Certificate; import java.security.cert.X509Certificate; /* loaded from: classes6.dex */ public final class grY implements CertSelector, InterfaceC15467grM { private gpQ c; private grY(AbstractC15317gnH abstractC15317gnH) { this.c = abstractC15317gnH != null ? new gpQ(AbstractC15317gnH.a(abstractC15317gnH)) : null; } private static boolean a(gqV gqv, gpP gpp) { gpO[] gpoArr = gpp.b; int length = gpoArr.length; gpO[] gpoArr2 = new gpO[length]; System.arraycopy(gpoArr, 0, gpoArr2, 0, gpoArr.length); for (int i = 0; i != length; i++) { gpO gpo = gpoArr2[i]; if (gpo.e == 4) { try { if (new gqV(gpo.d.i().l()).equals(gqv)) { return true; } } catch (IOException unused) { continue; } } } return false; } @Override // java.security.cert.CertSelector, o.InterfaceC15467grM public final Object clone() { return new grY((AbstractC15317gnH) this.c.i()); } @Override // java.security.cert.CertSelector public final boolean match(Certificate certificate) { if (!(certificate instanceof X509Certificate)) { return false; } X509Certificate x509Certificate = (X509Certificate) certificate; if (this.c.a != null) { return new BigInteger(this.c.a.e.b).equals(x509Certificate.getSerialNumber()) && a(gqO.d(x509Certificate), this.c.a.c); } if (this.c.c != null && a(gqO.b(x509Certificate), this.c.c)) { return true; } if (this.c.d != null) { MessageDigest messageDigest = MessageDigest.getInstance(this.c.d != null ? this.c.d.c.e.d : null, "SC"); int intValue = this.c.d != null ? new BigInteger(this.c.d.a.a).intValue() : -1; if (intValue == 0) { messageDigest.update(certificate.getPublicKey().getEncoded()); } else if (intValue == 1) { messageDigest.update(certificate.getEncoded()); } grK.b(messageDigest.digest(), this.c.d != null ? this.c.d.b.b() : null); } return false; } public final boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof grY) { return this.c.equals(((grY) obj).c); } return false; } public final int hashCode() { return this.c.hashCode(); } }