< prev index next >

src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java

Print this page
rev 47329 : 8189102: All tools should support -?, -h and --help


 426                         rb.getString("This.option.is.deprecated") +
 427                                 "-altsignerpath");
 428             } else if (collator.compare(flags, "-sectionsonly") ==0) {
 429                 signManifest = false;
 430             } else if (collator.compare(flags, "-internalsf") ==0) {
 431                 externalSF = false;
 432             } else if (collator.compare(flags, "-verify") ==0) {
 433                 verify = true;
 434             } else if (collator.compare(flags, "-verbose") ==0) {
 435                 verbose = (modifier != null) ? modifier : "all";
 436             } else if (collator.compare(flags, "-sigalg") ==0) {
 437                 if (++n == args.length) usageNoArg();
 438                 sigalg = args[n];
 439             } else if (collator.compare(flags, "-digestalg") ==0) {
 440                 if (++n == args.length) usageNoArg();
 441                 digestalg = args[n];
 442             } else if (collator.compare(flags, "-certs") ==0) {
 443                 showcerts = true;
 444             } else if (collator.compare(flags, "-strict") ==0) {
 445                 strict = true;
 446             } else if (collator.compare(flags, "-h") == 0 ||
 447                         collator.compare(flags, "-?") == 0 ||


 448                         collator.compare(flags, "-help") == 0) {
 449                 fullusage();
 450             } else {
 451                 System.err.println(
 452                         rb.getString("Illegal.option.") + flags);
 453                 usage();
 454             }
 455         }
 456 
 457         // -certs must always be specified with -verbose
 458         if (verbose == null) showcerts = false;
 459 
 460         if (jarfile == null) {
 461             System.err.println(rb.getString("Please.specify.jarfile.name"));
 462             usage();
 463         }
 464         if (!verify && alias == null) {
 465             System.err.println(rb.getString("Please.specify.alias.name"));
 466             usage();
 467         }


 616                 (".protected.keystore.has.protected.authentication.path"));
 617         System.out.println();
 618         System.out.println(rb.getString
 619                 (".providerName.name.provider.name"));
 620         System.out.println();
 621         System.out.println(rb.getString
 622                 (".add.provider.option"));
 623         System.out.println(rb.getString
 624                 (".providerArg.option.1"));
 625         System.out.println();
 626         System.out.println(rb.getString
 627                 (".providerClass.option"));
 628         System.out.println(rb.getString
 629                 (".providerArg.option.2"));
 630         System.out.println();
 631         System.out.println(rb.getString
 632                 (".strict.treat.warnings.as.errors"));
 633         System.out.println();
 634         System.out.println(rb.getString
 635                 (".conf.url.specify.a.pre.configured.options.file"));



 636         System.out.println();
 637 
 638         System.exit(0);
 639     }
 640 
 641     void verifyJar(String jarName)
 642         throws Exception
 643     {
 644         boolean anySigned = false;  // if there exists entry inside jar signed
 645         JarFile jf = null;
 646         Map<String,String> digestMap = new HashMap<>();
 647         Map<String,PKCS7> sigMap = new HashMap<>();
 648         Map<String,String> sigNameMap = new HashMap<>();
 649         Map<String,String> unparsableSignatures = new HashMap<>();
 650 
 651         try {
 652             jf = new JarFile(jarName, true);
 653             Vector<JarEntry> entriesVec = new Vector<>();
 654             byte[] buffer = new byte[8192];
 655 




 426                         rb.getString("This.option.is.deprecated") +
 427                                 "-altsignerpath");
 428             } else if (collator.compare(flags, "-sectionsonly") ==0) {
 429                 signManifest = false;
 430             } else if (collator.compare(flags, "-internalsf") ==0) {
 431                 externalSF = false;
 432             } else if (collator.compare(flags, "-verify") ==0) {
 433                 verify = true;
 434             } else if (collator.compare(flags, "-verbose") ==0) {
 435                 verbose = (modifier != null) ? modifier : "all";
 436             } else if (collator.compare(flags, "-sigalg") ==0) {
 437                 if (++n == args.length) usageNoArg();
 438                 sigalg = args[n];
 439             } else if (collator.compare(flags, "-digestalg") ==0) {
 440                 if (++n == args.length) usageNoArg();
 441                 digestalg = args[n];
 442             } else if (collator.compare(flags, "-certs") ==0) {
 443                 showcerts = true;
 444             } else if (collator.compare(flags, "-strict") ==0) {
 445                 strict = true;
 446             } else if (collator.compare(flags, "-?") == 0 ||
 447                        collator.compare(flags, "-h") == 0 ||
 448                        collator.compare(flags, "--help") == 0 ||
 449                        // -help: legacy. Undocumented.
 450                        collator.compare(flags, "-help") == 0) {
 451                 fullusage();
 452             } else {
 453                 System.err.println(
 454                         rb.getString("Illegal.option.") + flags);
 455                 usage();
 456             }
 457         }
 458 
 459         // -certs must always be specified with -verbose
 460         if (verbose == null) showcerts = false;
 461 
 462         if (jarfile == null) {
 463             System.err.println(rb.getString("Please.specify.jarfile.name"));
 464             usage();
 465         }
 466         if (!verify && alias == null) {
 467             System.err.println(rb.getString("Please.specify.alias.name"));
 468             usage();
 469         }


 618                 (".protected.keystore.has.protected.authentication.path"));
 619         System.out.println();
 620         System.out.println(rb.getString
 621                 (".providerName.name.provider.name"));
 622         System.out.println();
 623         System.out.println(rb.getString
 624                 (".add.provider.option"));
 625         System.out.println(rb.getString
 626                 (".providerArg.option.1"));
 627         System.out.println();
 628         System.out.println(rb.getString
 629                 (".providerClass.option"));
 630         System.out.println(rb.getString
 631                 (".providerArg.option.2"));
 632         System.out.println();
 633         System.out.println(rb.getString
 634                 (".strict.treat.warnings.as.errors"));
 635         System.out.println();
 636         System.out.println(rb.getString
 637                 (".conf.url.specify.a.pre.configured.options.file"));
 638         System.out.println();
 639         System.out.println(rb.getString
 640                 (".print.this.help.message"));
 641         System.out.println();
 642 
 643         System.exit(0);
 644     }
 645 
 646     void verifyJar(String jarName)
 647         throws Exception
 648     {
 649         boolean anySigned = false;  // if there exists entry inside jar signed
 650         JarFile jf = null;
 651         Map<String,String> digestMap = new HashMap<>();
 652         Map<String,PKCS7> sigMap = new HashMap<>();
 653         Map<String,String> sigNameMap = new HashMap<>();
 654         Map<String,String> unparsableSignatures = new HashMap<>();
 655 
 656         try {
 657             jf = new JarFile(jarName, true);
 658             Vector<JarEntry> entriesVec = new Vector<>();
 659             byte[] buffer = new byte[8192];
 660 


< prev index next >