what-the-bank/sources/org/bouncycastle/x509/PKIXCRLUtil.java

79 lines
3.4 KiB
Java

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