summaryrefslogtreecommitdiff
path: root/src/cz/crcs/ectester/standalone/ECTesterStandalone.java
diff options
context:
space:
mode:
authorJ08nY2017-11-26 19:19:40 +0100
committerJ08nY2017-11-26 19:20:02 +0100
commit2279aef8b7c00ba2bb71fdedae77ae4a47b00fc6 (patch)
tree170d89e814f7b8110f15564ca22c16f6b1070603 /src/cz/crcs/ectester/standalone/ECTesterStandalone.java
parent942c287dc46227c87e8683a389d01006e23cb52a (diff)
downloadECTester-2279aef8b7c00ba2bb71fdedae77ae4a47b00fc6.tar.gz
ECTester-2279aef8b7c00ba2bb71fdedae77ae4a47b00fc6.tar.zst
ECTester-2279aef8b7c00ba2bb71fdedae77ae4a47b00fc6.zip
Make sure the SPI by the intended provider is always used.
- JCA implements failover in its Delegates(classes between a Service and its SPI), which catches RuntimeExceptions and changes to another SPI by possibly another provider, we do not want this to happen. There is no public API for disabling this, however calling .getProvider() on a Service fixates the provider to the returned one.
Diffstat (limited to 'src/cz/crcs/ectester/standalone/ECTesterStandalone.java')
-rw-r--r--src/cz/crcs/ectester/standalone/ECTesterStandalone.java77
1 files changed, 50 insertions, 27 deletions
diff --git a/src/cz/crcs/ectester/standalone/ECTesterStandalone.java b/src/cz/crcs/ectester/standalone/ECTesterStandalone.java
index a2c52fc..741d81e 100644
--- a/src/cz/crcs/ectester/standalone/ECTesterStandalone.java
+++ b/src/cz/crcs/ectester/standalone/ECTesterStandalone.java
@@ -64,11 +64,6 @@ public class ECTesterStandalone {
}
dataStore = new EC_Store();
- if (cli.hasOption("list-named")) {
- CLITools.listNamed(dataStore, cli.getOptionValue("list-named"));
- return;
- }
-
for (ECLibrary lib : libs) {
lib.initialize();
}
@@ -78,15 +73,15 @@ public class ECTesterStandalone {
} else if (cli.isNext("list-data")) {
CLITools.listNamed(dataStore, cli.getNext().getArg(0));
} else if (cli.isNext("ecdh")) {
-
+ ecdh();
} else if (cli.isNext("ecdsa")) {
-
+ ecdsa();
} else if (cli.isNext("generate")) {
generate();
} else if (cli.isNext("test")) {
-
+ test();
} else if (cli.isNext("export")) {
-
+ export();
}
} catch (ParseException | NoSuchAlgorithmException | IOException ex) {
@@ -148,6 +143,43 @@ public class ECTesterStandalone {
/**
*
*/
+ private void listLibraries() {
+ for (ECLibrary lib : libs) {
+ if (lib.isInitialized() && (cfg.selected == null || lib == cfg.selected)) {
+ System.out.println("\t- " + lib.name());
+ Set<KeyPairGeneratorIdent> kpgs = lib.getKPGs();
+ if (!kpgs.isEmpty()) {
+ System.out.println("\t\t- KeyPairGenerators: " + String.join(",", kpgs.stream().map(KeyPairGeneratorIdent::getName).collect(Collectors.toList())));
+ }
+ Set<KeyAgreementIdent> eckas = lib.getECKAs();
+ if (!eckas.isEmpty()) {
+ System.out.println("\t\t- KeyAgreements: " + String.join(",", eckas.stream().map(KeyAgreementIdent::getName).collect(Collectors.toList())));
+ }
+ Set<SignatureIdent> sigs = lib.getECSigs();
+ if (!eckas.isEmpty()) {
+ System.out.println("\t\t- Signatures: " + String.join(",", sigs.stream().map(SignatureIdent::getName).collect(Collectors.toList())));
+ }
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ private void ecdh() {
+
+ }
+
+ /**
+ *
+ */
+ private void ecdsa() {
+
+ }
+
+ /**
+ *
+ */
private void generate() throws NoSuchAlgorithmException, InvalidAlgorithmParameterException {
if (cfg.selected instanceof JavaECLibrary) {
JavaECLibrary jlib = (JavaECLibrary) cfg.selected;
@@ -192,24 +224,15 @@ public class ECTesterStandalone {
/**
*
*/
- private void listLibraries() {
- for (ECLibrary lib : libs) {
- if (lib.isInitialized() && (cfg.selected == null || lib == cfg.selected)) {
- System.out.println("\t- " + lib.name());
- Set<KeyPairGeneratorIdent> kpgs = lib.getKPGs();
- if (!kpgs.isEmpty()) {
- System.out.println("\t\t- KeyPairGenerators: " + String.join(",", kpgs.stream().map(KeyPairGeneratorIdent::getName).collect(Collectors.toList())));
- }
- Set<KeyAgreementIdent> eckas = lib.getECKAs();
- if (!eckas.isEmpty()) {
- System.out.println("\t\t- KeyAgreements: " + String.join(",", eckas.stream().map(KeyAgreementIdent::getName).collect(Collectors.toList())));
- }
- Set<SignatureIdent> sigs = lib.getECSigs();
- if (!eckas.isEmpty()) {
- System.out.println("\t\t- Signatures: " + String.join(",", sigs.stream().map(SignatureIdent::getName).collect(Collectors.toList())));
- }
- }
- }
+ private void test() {
+
+ }
+
+ /**
+ *
+ */
+ private void export() {
+
}
public static void main(String[] args) {