what-the-bank/sources/org/bouncycastle/jce/provider/PKIXCRLUtil.java

65 lines
2.6 KiB
Java

package org.bouncycastle.jce.provider;
import java.security.cert.CertStore;
import java.security.cert.CertStoreException;
import java.security.cert.X509CRL;
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 org.bouncycastle.jcajce.PKIXCRLStoreSelector;
import org.bouncycastle.util.Store;
import org.bouncycastle.util.StoreException;
/* loaded from: classes6.dex */
class PKIXCRLUtil {
public Set findCRLs(PKIXCRLStoreSelector pKIXCRLStoreSelector, Date date, List list, List list2) throws AnnotatedException {
X509Certificate certificateChecking;
HashSet<X509CRL> hashSet = new HashSet();
try {
hashSet.addAll(findCRLs(pKIXCRLStoreSelector, list2));
hashSet.addAll(findCRLs(pKIXCRLStoreSelector, list));
HashSet hashSet2 = new HashSet();
for (X509CRL x509crl : hashSet) {
if (x509crl.getNextUpdate().after(date) && ((certificateChecking = pKIXCRLStoreSelector.getCertificateChecking()) == null || x509crl.getThisUpdate().before(certificateChecking.getNotAfter()))) {
hashSet2.add(x509crl);
}
}
return hashSet2;
} catch (AnnotatedException e) {
throw new AnnotatedException("Exception obtaining complete CRLs.", e);
}
}
private final Collection findCRLs(PKIXCRLStoreSelector pKIXCRLStoreSelector, List list) throws AnnotatedException {
AnnotatedException annotatedException;
HashSet hashSet = new HashSet();
AnnotatedException annotatedException2 = null;
boolean z = false;
for (Object obj : list) {
if (obj instanceof Store) {
try {
hashSet.addAll(((Store) obj).getMatches(pKIXCRLStoreSelector));
} catch (StoreException e) {
annotatedException = new AnnotatedException("Exception searching in X.509 CRL store.", e);
annotatedException2 = annotatedException;
}
} else {
try {
hashSet.addAll(PKIXCRLStoreSelector.getCRLs(pKIXCRLStoreSelector, (CertStore) obj));
} 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;
}
}