package o; import java.security.cert.CRLSelector; import java.security.cert.CertStore; import java.security.cert.CertStoreException; import java.security.cert.X509CRL; import java.security.cert.X509CRLSelector; import java.security.cert.X509Certificate; import java.util.Collection; import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Set; import o.C15454gqw; import org.spongycastle.jce.provider.AnnotatedException; import org.spongycastle.util.StoreException; /* renamed from: o.grf, reason: case insensitive filesystem */ /* loaded from: classes6.dex */ final class C15478grf { public static Set b(C15454gqw c15454gqw, Date date, List list, List list2) throws AnnotatedException { HashSet hashSet = new HashSet(); try { hashSet.addAll(e(c15454gqw, list2)); hashSet.addAll(e(c15454gqw, list)); HashSet hashSet2 = new HashSet(); for (X509CRL x509crl : hashSet) { if (x509crl.getNextUpdate().after(date)) { CRLSelector cRLSelector = c15454gqw.c; X509Certificate certificateChecking = cRLSelector instanceof X509CRLSelector ? ((X509CRLSelector) cRLSelector).getCertificateChecking() : null; if (certificateChecking != null) { if (x509crl.getThisUpdate().before(certificateChecking.getNotAfter())) { hashSet2.add(x509crl); } } else { hashSet2.add(x509crl); } } } return hashSet2; } catch (AnnotatedException e) { throw new AnnotatedException("Exception obtaining complete CRLs.", e); } } private static Collection e(C15454gqw c15454gqw, List list) throws AnnotatedException { AnnotatedException annotatedException; HashSet hashSet = new HashSet(); AnnotatedException annotatedException2 = null; boolean z = false; for (Object obj : list) { if (obj instanceof InterfaceC15465grJ) { try { hashSet.addAll(((InterfaceC15465grJ) obj).b()); } catch (StoreException e) { annotatedException = new AnnotatedException("Exception searching in X.509 CRL store.", e); annotatedException2 = annotatedException; } } else { try { hashSet.addAll(((CertStore) obj).getCRLs(new C15454gqw.Sts(c15454gqw))); } catch (CertStoreException e2) { annotatedException = new AnnotatedException("Exception searching in X.509 CRL store.", e2); annotatedException2 = annotatedException; } } z = true; } if (z || annotatedException2 == null) { return hashSet; } throw annotatedException2; } }