1 package org.bouncycastle.jce.provider; 2 3 import java.security.cert.CertPathValidatorException; 4 import java.security.cert.Certificate; 5 import java.security.cert.X509Certificate; 6 import java.util.Date; 7 8 import org.bouncycastle.jcajce.PKIXCertRevocationChecker; 9 import org.bouncycastle.jcajce.PKIXCertRevocationCheckerParameters; 10 import org.bouncycastle.jcajce.util.JcaJceHelper; 11 12 class ProvCrlRevocationChecker 13 implements PKIXCertRevocationChecker 14 { 15 private final JcaJceHelper helper; 16 17 private PKIXCertRevocationCheckerParameters params; 18 private Date currentDate = null; 19 ProvCrlRevocationChecker(JcaJceHelper helper)20 public ProvCrlRevocationChecker(JcaJceHelper helper) 21 { 22 this.helper = helper; 23 } 24 setParameter(String name, Object value)25 public void setParameter(String name, Object value) 26 { 27 28 } 29 initialize(PKIXCertRevocationCheckerParameters params)30 public void initialize(PKIXCertRevocationCheckerParameters params) 31 { 32 this.params = params; 33 this.currentDate = new Date(); 34 } 35 init(boolean forForward)36 public void init(boolean forForward) 37 throws CertPathValidatorException 38 { 39 if (forForward) 40 { 41 throw new CertPathValidatorException("forward checking not supported"); 42 } 43 44 this.params = null; 45 this.currentDate = new Date(); 46 } 47 check(Certificate certificate)48 public void check(Certificate certificate) 49 throws CertPathValidatorException 50 { 51 try 52 { 53 RFC3280CertPathUtilities.checkCRLs(params, params.getParamsPKIX(), currentDate, params.getValidDate(), 54 (X509Certificate)certificate, params.getSigningCert(), params.getWorkingPublicKey(), 55 params.getCertPath().getCertificates(), helper); 56 } 57 catch (AnnotatedException e) 58 { 59 Throwable cause = e; 60 if (null != e.getCause()) 61 { 62 cause = e.getCause(); 63 } 64 throw new CertPathValidatorException(e.getMessage(), cause, params.getCertPath(), params.getIndex()); 65 } 66 } 67 } 68