private void checkPolicy(X509Certificate currCert) throws CertPathValidatorException {
  String msg="certificate policies";
  if (debug != null) {
    debug.println("PolicyChecker.checkPolicy() ---checking " + msg + "...");
    debug.println("PolicyChecker.checkPolicy() certIndex = " + certIndex);
    debug.println("PolicyChecker.checkPolicy() BEFORE PROCESSING: " + "explicitPolicy = " + explicitPolicy);
    debug.println("PolicyChecker.checkPolicy() BEFORE PROCESSING: " + "policyMapping = " + policyMapping);
    debug.println("PolicyChecker.checkPolicy() BEFORE PROCESSING: " + "inhibitAnyPolicy = " + inhibitAnyPolicy);
    debug.println("PolicyChecker.checkPolicy() BEFORE PROCESSING: " + "policyTree = " + rootNode);
  }
  X509CertImpl currCertImpl=null;
  try {
    currCertImpl=X509CertImpl.toImpl(currCert);
  }
 catch (  CertificateException ce) {
    throw new CertPathValidatorException(ce);
  }
  boolean finalCert=(certIndex == certPathLen);
  rootNode=processPolicies(certIndex,initPolicies,explicitPolicy,policyMapping,inhibitAnyPolicy,rejectPolicyQualifiers,rootNode,currCertImpl,finalCert);
  if (!finalCert) {
    explicitPolicy=mergeExplicitPolicy(explicitPolicy,currCertImpl,finalCert);
    policyMapping=mergePolicyMapping(policyMapping,currCertImpl);
    inhibitAnyPolicy=mergeInhibitAnyPolicy(inhibitAnyPolicy,currCertImpl);
  }
  certIndex++;
  if (debug != null) {
    debug.println("PolicyChecker.checkPolicy() AFTER PROCESSING: " + "explicitPolicy = " + explicitPolicy);
    debug.println("PolicyChecker.checkPolicy() AFTER PROCESSING: " + "policyMapping = " + policyMapping);
    debug.println("PolicyChecker.checkPolicy() AFTER PROCESSING: " + "inhibitAnyPolicy = " + inhibitAnyPolicy);
    debug.println("PolicyChecker.checkPolicy() AFTER PROCESSING: " + "policyTree = " + rootNode);
    debug.println("PolicyChecker.checkPolicy() " + msg + " verified");
  }
}

private void checkPolicy ( X509Certificate currCert ) throws CertPathValidatorException { String msg = "certificate policies" ; if ( debug != null ) { debug . println ( "PolicyChecker.checkPolicy() ---checking " + msg + "..." ) ; debug . println ( "PolicyChecker.checkPolicy() certIndex = " + certIndex ) ; debug . println ( "PolicyChecker.checkPolicy() BEFORE PROCESSING: " + "explicitPolicy = " + explicitPolicy ) ; debug . println ( "PolicyChecker.checkPolicy() BEFORE PROCESSING: " + "policyMapping = " + policyMapping ) ; debug . println ( "PolicyChecker.checkPolicy() BEFORE PROCESSING: " + "inhibitAnyPolicy = " + inhibitAnyPolicy ) ; debug . println ( "PolicyChecker.checkPolicy() BEFORE PROCESSING: " + "policyTree = " + rootNode ) ; } X509CertImpl currCertImpl = null ; try { currCertImpl = X509CertImpl . toImpl ( currCert ) ; } catch ( CertificateException ce ) { throw new CertPathValidatorException ( ce ) ; } boolean finalCert = ( certIndex == certPathLen ) ; rootNode = processPolicies ( certIndex , initPolicies , explicitPolicy , policyMapping , inhibitAnyPolicy , rejectPolicyQualifiers , rootNode , currCertImpl , finalCert ) ; if ( ! finalCert ) { explicitPolicy = mergeExplicitPolicy ( explicitPolicy , currCertImpl , finalCert ) ; policyMapping = mergePolicyMapping ( policyMapping , currCertImpl ) ; inhibitAnyPolicy = mergeInhibitAnyPolicy ( inhibitAnyPolicy , currCertImpl ) ; } certIndex ++ ; if ( debug != null ) { debug . println ( "PolicyChecker.checkPolicy() AFTER PROCESSING: " + "explicitPolicy = " + explicitPolicy ) ; debug . println ( "PolicyChecker.checkPolicy() AFTER PROCESSING: " + "policyMapping = " + policyMapping ) ; debug . println ( "PolicyChecker.checkPolicy() AFTER PROCESSING: " + "inhibitAnyPolicy = " + inhibitAnyPolicy ) ; debug . println ( "PolicyChecker.checkPolicy() AFTER PROCESSING: " + "policyTree = " + rootNode ) ; debug . println ( "PolicyChecker.checkPolicy() " + msg + " verified" ) ; } }
internal method to run through all the checks .
