// 
// Decompiled by Procyon v0.6.0
// 

package org.bouncycastle.jce.provider;

import java.util.List;
import java.security.cert.X509Certificate;
import java.security.cert.Certificate;
import java.security.cert.CertPathValidatorException;
import java.util.Date;
import org.bouncycastle.jcajce.PKIXCertRevocationCheckerParameters;
import org.bouncycastle.jcajce.util.JcaJceHelper;
import org.bouncycastle.jcajce.PKIXCertRevocationChecker;

class ProvCrlRevocationChecker implements PKIXCertRevocationChecker
{
    private final JcaJceHelper helper;
    private PKIXCertRevocationCheckerParameters params;
    private Date currentDate;
    
    public ProvCrlRevocationChecker(final JcaJceHelper helper) {
        this.currentDate = null;
        this.helper = helper;
    }
    
    @Override
    public void setParameter(final String s, final Object o) {
    }
    
    @Override
    public void initialize(final PKIXCertRevocationCheckerParameters params) {
        this.params = params;
        this.currentDate = new Date();
    }
    
    public void init(final boolean b) throws CertPathValidatorException {
        if (b) {
            throw new CertPathValidatorException("forward checking not supported");
        }
        this.params = null;
        this.currentDate = new Date();
    }
    
    @Override
    public void check(final Certificate certificate) throws CertPathValidatorException {
        try {
            RFC3280CertPathUtilities.checkCRLs(this.params, this.params.getParamsPKIX(), this.currentDate, this.params.getValidDate(), (X509Certificate)certificate, this.params.getSigningCert(), this.params.getWorkingPublicKey(), this.params.getCertPath().getCertificates(), this.helper);
        }
        catch (final AnnotatedException ex) {
            Throwable cause = ex;
            if (null != ex.getCause()) {
                cause = ex.getCause();
            }
            throw new CertPathValidatorException(ex.getMessage(), cause, this.params.getCertPath(), this.params.getIndex());
        }
    }
}
