< prev index next >

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

Print this page
rev 48074 : 8189102: All tools should support -?, -h and --help
Reviewed-by: kvn, jjg, weijun, alanb, rfield, ksrini


 440                         rb.getString("This.option.is.deprecated") +
 441                                 "-altsignerpath");
 442             } else if (collator.compare(flags, "-sectionsonly") ==0) {
 443                 signManifest = false;
 444             } else if (collator.compare(flags, "-internalsf") ==0) {
 445                 externalSF = false;
 446             } else if (collator.compare(flags, "-verify") ==0) {
 447                 verify = true;
 448             } else if (collator.compare(flags, "-verbose") ==0) {
 449                 verbose = (modifier != null) ? modifier : "all";
 450             } else if (collator.compare(flags, "-sigalg") ==0) {
 451                 if (++n == args.length) usageNoArg();
 452                 sigalg = args[n];
 453             } else if (collator.compare(flags, "-digestalg") ==0) {
 454                 if (++n == args.length) usageNoArg();
 455                 digestalg = args[n];
 456             } else if (collator.compare(flags, "-certs") ==0) {
 457                 showcerts = true;
 458             } else if (collator.compare(flags, "-strict") ==0) {
 459                 strict = true;
 460             } else if (collator.compare(flags, "-h") == 0 ||
 461                         collator.compare(flags, "-?") == 0 ||


 462                         collator.compare(flags, "-help") == 0) {
 463                 fullusage();
 464             } else {
 465                 System.err.println(
 466                         rb.getString("Illegal.option.") + flags);
 467                 usage();
 468             }
 469         }
 470 
 471         // -certs must always be specified with -verbose
 472         if (verbose == null) showcerts = false;
 473 
 474         if (jarfile == null) {
 475             System.err.println(rb.getString("Please.specify.jarfile.name"));
 476             usage();
 477         }
 478         if (!verify && alias == null) {
 479             System.err.println(rb.getString("Please.specify.alias.name"));
 480             usage();
 481         }


 630                 (".protected.keystore.has.protected.authentication.path"));
 631         System.out.println();
 632         System.out.println(rb.getString
 633                 (".providerName.name.provider.name"));
 634         System.out.println();
 635         System.out.println(rb.getString
 636                 (".add.provider.option"));
 637         System.out.println(rb.getString
 638                 (".providerArg.option.1"));
 639         System.out.println();
 640         System.out.println(rb.getString
 641                 (".providerClass.option"));
 642         System.out.println(rb.getString
 643                 (".providerArg.option.2"));
 644         System.out.println();
 645         System.out.println(rb.getString
 646                 (".strict.treat.warnings.as.errors"));
 647         System.out.println();
 648         System.out.println(rb.getString
 649                 (".conf.url.specify.a.pre.configured.options.file"));



 650         System.out.println();
 651 
 652         System.exit(0);
 653     }
 654 
 655     void verifyJar(String jarName)
 656         throws Exception
 657     {
 658         boolean anySigned = false;  // if there exists entry inside jar signed
 659         JarFile jf = null;
 660         Map<String,String> digestMap = new HashMap<>();
 661         Map<String,PKCS7> sigMap = new HashMap<>();
 662         Map<String,String> sigNameMap = new HashMap<>();
 663         Map<String,String> unparsableSignatures = new HashMap<>();
 664 
 665         try {
 666             jf = new JarFile(jarName, true);
 667             Vector<JarEntry> entriesVec = new Vector<>();
 668             byte[] buffer = new byte[8192];
 669 




 440                         rb.getString("This.option.is.deprecated") +
 441                                 "-altsignerpath");
 442             } else if (collator.compare(flags, "-sectionsonly") ==0) {
 443                 signManifest = false;
 444             } else if (collator.compare(flags, "-internalsf") ==0) {
 445                 externalSF = false;
 446             } else if (collator.compare(flags, "-verify") ==0) {
 447                 verify = true;
 448             } else if (collator.compare(flags, "-verbose") ==0) {
 449                 verbose = (modifier != null) ? modifier : "all";
 450             } else if (collator.compare(flags, "-sigalg") ==0) {
 451                 if (++n == args.length) usageNoArg();
 452                 sigalg = args[n];
 453             } else if (collator.compare(flags, "-digestalg") ==0) {
 454                 if (++n == args.length) usageNoArg();
 455                 digestalg = args[n];
 456             } else if (collator.compare(flags, "-certs") ==0) {
 457                 showcerts = true;
 458             } else if (collator.compare(flags, "-strict") ==0) {
 459                 strict = true;
 460             } else if (collator.compare(flags, "-?") == 0 ||
 461                        collator.compare(flags, "-h") == 0 ||
 462                        collator.compare(flags, "--help") == 0 ||
 463                        // -help: legacy.
 464                        collator.compare(flags, "-help") == 0) {
 465                 fullusage();
 466             } else {
 467                 System.err.println(
 468                         rb.getString("Illegal.option.") + flags);
 469                 usage();
 470             }
 471         }
 472 
 473         // -certs must always be specified with -verbose
 474         if (verbose == null) showcerts = false;
 475 
 476         if (jarfile == null) {
 477             System.err.println(rb.getString("Please.specify.jarfile.name"));
 478             usage();
 479         }
 480         if (!verify && alias == null) {
 481             System.err.println(rb.getString("Please.specify.alias.name"));
 482             usage();
 483         }


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


< prev index next >