diff options
| author | davidhofman | 2021-10-08 16:44:37 +0200 |
|---|---|---|
| committer | GitHub | 2021-10-08 16:44:37 +0200 |
| commit | 22ef8bacc8f8238cfe07f12f2fa94b45deee04b2 (patch) | |
| tree | 94c8328f567344558d4bda0e4916fa20ea60dd33 /src/cz/crcs/ectester/standalone/test/suites/StandaloneWrongSuite.java | |
| parent | bd9de73be52f738b6346e5003b79114d212666bc (diff) | |
| download | ECTester-22ef8bacc8f8238cfe07f12f2fa94b45deee04b2.tar.gz ECTester-22ef8bacc8f8238cfe07f12f2fa94b45deee04b2.tar.zst ECTester-22ef8bacc8f8238cfe07f12f2fa94b45deee04b2.zip | |
Add 2 scripts for testing libraries. Change suites to prevent error in some libraries. (#14)
* Add two scripts for testing libraries.
* Fix KeyAgreement phase already executed error
* Small change to the new testing script.
* Fix comments in Composite suite.
Diffstat (limited to '')
| -rw-r--r-- | src/cz/crcs/ectester/standalone/test/suites/StandaloneWrongSuite.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cz/crcs/ectester/standalone/test/suites/StandaloneWrongSuite.java b/src/cz/crcs/ectester/standalone/test/suites/StandaloneWrongSuite.java index 589c0d7..79b0b7d 100644 --- a/src/cz/crcs/ectester/standalone/test/suites/StandaloneWrongSuite.java +++ b/src/cz/crcs/ectester/standalone/test/suites/StandaloneWrongSuite.java @@ -22,6 +22,7 @@ import javax.crypto.KeyAgreement; import java.math.BigInteger; import java.security.KeyPair; import java.security.KeyPairGenerator; +import java.security.NoSuchAlgorithmException; import java.security.interfaces.ECPrivateKey; import java.security.interfaces.ECPublicKey; import java.security.spec.*; @@ -32,7 +33,7 @@ import java.util.stream.Collectors; * @author David Hofman */ public class StandaloneWrongSuite extends StandaloneTestSuite { - private KeyAgreement ka; + private KeyAgreementIdent kaIdent; private KeyPairGenerator kpg; public StandaloneWrongSuite(TestWriter writer, ECTesterStandalone.Config cfg, TreeCommandLine cli) { @@ -76,7 +77,6 @@ public class StandaloneWrongSuite extends StandaloneTestSuite { } kpg = kpgIdent.getInstance(cfg.selected.getProvider()); - KeyAgreementIdent kaIdent; if (kaAlgo == null) { // try ECDH, if not, fail with: need to specify ka algo. Optional<KeyAgreementIdent> kaIdentOpt = cfg.selected.getKAs().stream() @@ -100,7 +100,6 @@ public class StandaloneWrongSuite extends StandaloneTestSuite { return; } } - ka = kaIdent.getInstance(cfg.selected.getProvider()); /* Just do the default run on the wrong curves. * These should generally fail, the curves aren't curves. @@ -283,7 +282,7 @@ public class StandaloneWrongSuite extends StandaloneTestSuite { } } - private Test ecdhTest(ECParameterSpec spec, String desc) { + private Test ecdhTest(ECParameterSpec spec, String desc) throws NoSuchAlgorithmException { //generate KeyPair KeyGeneratorTestable kgt = new KeyGeneratorTestable(kpg, spec); Test generate = KeyGeneratorTest.expectError(kgt, Result.ExpectedValue.FAILURE); @@ -296,6 +295,7 @@ public class StandaloneWrongSuite extends StandaloneTestSuite { ECPrivateKey priv = (ECPrivateKey) kp.getPrivate(); //perform ECDH + KeyAgreement ka = kaIdent.getInstance(cfg.selected.getProvider()); KeyAgreementTestable testable = new KeyAgreementTestable(ka, priv, pub); Test ecdh = KeyAgreementTest.expect(testable, Result.ExpectedValue.FAILURE); return CompoundTest.all(Result.ExpectedValue.SUCCESS, desc, generate, ecdh); |
