diff options
| author | J08nY | 2018-10-15 18:16:03 +0200 |
|---|---|---|
| committer | J08nY | 2018-10-15 18:16:03 +0200 |
| commit | ee13937d70383e925cf32858e73d89a6c18bf7f0 (patch) | |
| tree | fa3f8dfd255b8a24d15dd1734fe327df56b8ac2c /src/cz/crcs/ectester/standalone/ECTesterStandalone.java | |
| parent | d24630d759bb16f715564ab80a5d4447f57d03f2 (diff) | |
| parent | ea4e807906815c16c62c4e5719950c7274d1ebab (diff) | |
| download | ECTester-ee13937d70383e925cf32858e73d89a6c18bf7f0.tar.gz ECTester-ee13937d70383e925cf32858e73d89a6c18bf7f0.tar.zst ECTester-ee13937d70383e925cf32858e73d89a6c18bf7f0.zip | |
Merge branch 'devel'
Diffstat (limited to 'src/cz/crcs/ectester/standalone/ECTesterStandalone.java')
| -rw-r--r-- | src/cz/crcs/ectester/standalone/ECTesterStandalone.java | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/src/cz/crcs/ectester/standalone/ECTesterStandalone.java b/src/cz/crcs/ectester/standalone/ECTesterStandalone.java index 31d291c..364fde4 100644 --- a/src/cz/crcs/ectester/standalone/ECTesterStandalone.java +++ b/src/cz/crcs/ectester/standalone/ECTesterStandalone.java @@ -86,7 +86,12 @@ public class ECTesterStandalone { CLITools.version(DESCRIPTION, LICENSE); return; } else if (cli.hasOption("help") || cli.getNext() == null) { - CLITools.help("ECTesterStandalone.jar", CLI_HEADER, opts, optParser, CLI_FOOTER, true); + String command = cli.getOptionValue("help"); + if (command == null) { + CLITools.help("ECTesterStandalone.jar", CLI_HEADER, opts, optParser, CLI_FOOTER, true); + } else { + CLITools.help(CLI_HEADER, optParser, CLI_FOOTER, command); + } return; } @@ -204,7 +209,7 @@ public class ECTesterStandalone { optParser = new TreeParser(actions, false, baseArgs); opts.addOption(Option.builder("V").longOpt("version").desc("Print version info.").build()); - opts.addOption(Option.builder("h").longOpt("help").desc("Print help.").build()); + opts.addOption(Option.builder("h").longOpt("help").desc("Print help(about <command>).").hasArg().argName("command").optionalArg(true).build()); opts.addOption(Option.builder("C").longOpt("color").desc("Print stuff with color, requires ANSI terminal.").build()); return optParser.parse(opts, args); @@ -264,16 +269,26 @@ public class ECTesterStandalone { .findFirst() .orElse(null); + String baseAlgo; + if (algo.contains("with")) { + baseAlgo = algo.split("with")[0]; + } else { + baseAlgo = algo; + } + KeyPairGeneratorIdent kpIdent = lib.getKPGs().stream() .filter((ident) -> ident.contains(algo)) .findFirst() .orElse(lib.getKPGs().stream() - .filter((ident) -> ident.contains("ECDH")) + .filter((ident) -> ident.contains(baseAlgo)) .findFirst() .orElse(lib.getKPGs().stream() - .filter((ident) -> ident.contains("EC")) + .filter((ident) -> ident.contains("ECDH")) .findFirst() - .orElse(null))); + .orElse(lib.getKPGs().stream() + .filter((ident) -> ident.contains("EC")) + .findFirst() + .orElse(null)))); if (kaIdent == null || kpIdent == null) { throw new NoSuchAlgorithmException(algo); @@ -367,13 +382,26 @@ public class ECTesterStandalone { .findFirst() .orElse(null); + String baseAlgo; + if (algo.contains("with")) { + baseAlgo = algo.split("with")[1]; + } else { + baseAlgo = algo; + } + KeyPairGeneratorIdent kpIdent = lib.getKPGs().stream() .filter((ident) -> ident.contains(algo)) .findFirst() .orElse(lib.getKPGs().stream() - .filter((ident) -> ident.contains("EC")) + .filter((ident) -> ident.contains(baseAlgo)) .findFirst() - .orElse(null)); + .orElse(lib.getKPGs().stream() + .filter((ident) -> ident.contains("ECDSA")) + .findFirst() + .orElse(lib.getKPGs().stream() + .filter((ident) -> ident.contains("EC")) + .findFirst() + .orElse(null)))); if (sigIdent == null || kpIdent == null) { throw new NoSuchAlgorithmException(algo); @@ -496,6 +524,8 @@ public class ECTesterStandalone { break; } + String suiteName = cli.getArg(0); + StandaloneTestSuite suite = new StandaloneDefaultSuite(writer, cfg, cli); suite.run(); } |
