static public boolean validateCertificate(X509Certificate cert,boolean checkCAStatus){
  String method="validateCertificate : ";
  boolean certgood=true;
  try {
    Vector crls=new Vector();
    X509CRL crl=AMCRLStore.getCRL(ldapParams,cert,crlSearchAttr);
    if (crl != null) {
      crls.add(crl);
    }
    if (debug.messageEnabled()) {
      debug.message(method + " crls size = " + crls.size());
      if (crls.size() > 0) {
        debug.message(method + "CRL = " + crls.toString());
      }
 else {
        debug.message(method + "NO CRL found.");
      }
    }
    AMCertPath certpath=new AMCertPath(crls);
    X509Certificate certs[]={cert};
    if (!certpath.verify(certs,true,false)) {
      debug.error(method + "CertPath:verify failed.");
      return certgood=false;
    }
  }
 catch (  Exception e) {
    debug.error(method + "verify failed.",e);
    return certgood=false;
  }
  if ((checkCAStatus == true) && (AMCertStore.isRootCA(cert) == false)) {
    X509Certificate caCert=AMCertStore.getIssuerCertificate(ldapParams,cert,crlSearchAttr);
    certgood=validateCertificate(caCert,checkCAStatus);
  }
  return certgood;
}

static public boolean validateCertificate ( X509Certificate cert , boolean checkCAStatus ) { String method = "validateCertificate : " ; boolean certgood = true ; try { Vector crls = new Vector ( ) ; X509CRL crl = AMCRLStore . getCRL ( ldapParams , cert , crlSearchAttr ) ; if ( crl != null ) { crls . add ( crl ) ; } if ( debug . messageEnabled ( ) ) { debug . message ( method + " crls size = " + crls . size ( ) ) ; if ( crls . size ( ) > 0 ) { debug . message ( method + "CRL = " + crls . toString ( ) ) ; } else { debug . message ( method + "NO CRL found." ) ; } } AMCertPath certpath = new AMCertPath ( crls ) ; X509Certificate certs [ ] = { cert } ; if ( ! certpath . verify ( certs , true , false ) ) { debug . error ( method + "CertPath:verify failed." ) ; return certgood = false ; } } catch ( Exception e ) { debug . error ( method + "verify failed." , e ) ; return certgood = false ; } if ( ( checkCAStatus == true ) && ( AMCertStore . isRootCA ( cert ) == false ) ) { X509Certificate caCert = AMCertStore . getIssuerCertificate ( ldapParams , cert , crlSearchAttr ) ; certgood = validateCertificate ( caCert , checkCAStatus ) ; } return certgood ; }
validate certificate against configured crl
