aboutsummaryrefslogtreecommitdiff
path: root/src/cz/crcs/ectester/standalone/ECTesterStandalone.java
diff options
context:
space:
mode:
authorJ08nY2017-11-12 23:39:35 +0100
committerJ08nY2017-11-12 23:39:35 +0100
commit9e615b101398bd4c8e2678bf86337e2756a8ee7a (patch)
tree61ac019b775ef7bb3eaba2519b8b1af9dbe8d6ef /src/cz/crcs/ectester/standalone/ECTesterStandalone.java
parente329190e496ecf847cfd7afa886ac08cacb2fc92 (diff)
downloadECTester-9e615b101398bd4c8e2678bf86337e2756a8ee7a.tar.gz
ECTester-9e615b101398bd4c8e2678bf86337e2756a8ee7a.tar.zst
ECTester-9e615b101398bd4c8e2678bf86337e2756a8ee7a.zip
Implement collecting of supported KeyAgreement and Signature objects.
Diffstat (limited to 'src/cz/crcs/ectester/standalone/ECTesterStandalone.java')
-rw-r--r--src/cz/crcs/ectester/standalone/ECTesterStandalone.java26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/cz/crcs/ectester/standalone/ECTesterStandalone.java b/src/cz/crcs/ectester/standalone/ECTesterStandalone.java
index d2cbce1..47b7121 100644
--- a/src/cz/crcs/ectester/standalone/ECTesterStandalone.java
+++ b/src/cz/crcs/ectester/standalone/ECTesterStandalone.java
@@ -1,12 +1,15 @@
package cz.crcs.ectester.standalone;
-import cz.crcs.ectester.common.Util;
import cz.crcs.ectester.applet.EC_Consts;
import cz.crcs.ectester.common.ec.EC_Curve;
import cz.crcs.ectester.data.EC_Store;
+import cz.crcs.ectester.standalone.libs.BouncyCastleLib;
+import cz.crcs.ectester.standalone.libs.ECLibrary;
+import cz.crcs.ectester.standalone.libs.SunECLib;
import org.apache.commons.cli.*;
import java.io.IOException;
+import java.util.Arrays;
/**
* Standalone part of ECTester, a tool for testing Elliptic curve implementations in software libraries.
@@ -16,6 +19,7 @@ import java.io.IOException;
*/
public class ECTesterStandalone {
+ private ECLibrary[] libs = new ECLibrary[]{new SunECLib(), new BouncyCastleLib()};
private EC_Store dataStore;
private Config cfg;
@@ -40,9 +44,17 @@ public class ECTesterStandalone {
cfg = new Config();
dataStore = new EC_Store();
+ for (ECLibrary lib : libs) {
+ lib.initialize();
+ lib.getECKAs();
+ lib.getECSigs();
+ }
+ System.out.println(Arrays.toString(libs));
if (cli.hasOption("generate")) {
generate();
+ } else if (cli.hasOption("libs")) {
+ listLibraries();
}
} catch (ParseException | IOException ex) {
@@ -56,6 +68,7 @@ public class ECTesterStandalone {
actions.addOption(Option.builder("V").longOpt("version").desc("Print version info.").build());
actions.addOption(Option.builder("h").longOpt("help").desc("Print help.").build());
actions.addOption(Option.builder("g").longOpt("generate").desc("Generate [amount] of EC keys.").hasArg().argName("amount").optionalArg(true).build());
+ actions.addOption(Option.builder("ls").longOpt("libs").desc("List supported libraries.").build());
opts.addOptionGroup(actions);
CommandLineParser parser = new DefaultParser();
@@ -88,6 +101,17 @@ public class ECTesterStandalone {
}
+ /**
+ *
+ */
+ private void listLibraries() {
+ for (ECLibrary lib : libs) {
+ if (lib.isInitialized()) {
+ System.out.println(lib.name());
+ }
+ }
+ }
+
public static void main(String[] args) {
ECTesterStandalone app = new ECTesterStandalone();
app.run(args);