private void checkCodeSigning(X509Certificate cert) throws CertificateException {
  Set<String> exts=getCriticalExtensions(cert);
  if (checkKeyUsage(cert,KU_SIGNATURE) == false) {
    throw new ValidatorException("KeyUsage does not allow digital signatures",ValidatorException.T_EE_EXTENSIONS,cert);
  }
  if (checkEKU(cert,exts,OID_EKU_CODE_SIGNING) == false) {
    throw new ValidatorException("Extended key usage does not permit use for code signing",ValidatorException.T_EE_EXTENSIONS,cert);
  }
  if (variant.equals(Validator.VAR_JCE_SIGNING) == false) {
    if (!SimpleValidator.getNetscapeCertTypeBit(cert,NSCT_CODE_SIGNING)) {
      throw new ValidatorException("Netscape cert type does not permit use for code signing",ValidatorException.T_EE_EXTENSIONS,cert);
    }
    exts.remove(SimpleValidator.OID_NETSCAPE_CERT_TYPE);
  }
  exts.remove(SimpleValidator.OID_KEY_USAGE);
  exts.remove(SimpleValidator.OID_EXTENDED_KEY_USAGE);
  checkRemainingExtensions(exts);
}

private void checkCodeSigning ( X509Certificate cert ) throws CertificateException { Set < String > exts = getCriticalExtensions ( cert ) ; if ( checkKeyUsage ( cert , KU_SIGNATURE ) == false ) { throw new ValidatorException ( "KeyUsage does not allow digital signatures" , ValidatorException . T_EE_EXTENSIONS , cert ) ; } if ( checkEKU ( cert , exts , OID_EKU_CODE_SIGNING ) == false ) { throw new ValidatorException ( "Extended key usage does not permit use for code signing" , ValidatorException . T_EE_EXTENSIONS , cert ) ; } if ( variant . equals ( Validator . VAR_JCE_SIGNING ) == false ) { if ( ! SimpleValidator . getNetscapeCertTypeBit ( cert , NSCT_CODE_SIGNING ) ) { throw new ValidatorException ( "Netscape cert type does not permit use for code signing" , ValidatorException . T_EE_EXTENSIONS , cert ) ; } exts . remove ( SimpleValidator . OID_NETSCAPE_CERT_TYPE ) ; } exts . remove ( SimpleValidator . OID_KEY_USAGE ) ; exts . remove ( SimpleValidator . OID_EXTENDED_KEY_USAGE ) ; checkRemainingExtensions ( exts ) ; }
check whether this certificate can be used for code signing .
