diff options
| author | J08nY | 2018-08-11 21:52:48 +0200 |
|---|---|---|
| committer | J08nY | 2018-08-11 22:03:39 +0200 |
| commit | b6d6766fef9b73db70bda8b6b398128ba5a41ab2 (patch) | |
| tree | a470e36aa69cb9e778070b175e9223432244f210 /src/cz/crcs/ectester/reader/test/CardCofactorSuite.java | |
| parent | 1284516b6630250a3fc4a2bf8d23e15fede5a77b (diff) | |
| download | ECTester-b6d6766fef9b73db70bda8b6b398128ba5a41ab2.tar.gz ECTester-b6d6766fef9b73db70bda8b6b398128ba5a41ab2.tar.zst ECTester-b6d6766fef9b73db70bda8b6b398128ba5a41ab2.zip | |
Add various ECDSA tests.
Diffstat (limited to '')
| -rw-r--r-- | src/cz/crcs/ectester/reader/test/CardCofactorSuite.java | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/src/cz/crcs/ectester/reader/test/CardCofactorSuite.java b/src/cz/crcs/ectester/reader/test/CardCofactorSuite.java index 39024b8..189adbe 100644 --- a/src/cz/crcs/ectester/reader/test/CardCofactorSuite.java +++ b/src/cz/crcs/ectester/reader/test/CardCofactorSuite.java @@ -15,7 +15,6 @@ import cz.crcs.ectester.reader.command.Command; import java.util.LinkedList; import java.util.List; import java.util.Map; -import java.util.Random; import static cz.crcs.ectester.common.test.Result.ExpectedValue; @@ -48,29 +47,11 @@ public class CardCofactorSuite extends CardTestSuite { } Test ecdh = CompoundTest.all(ExpectedValue.SUCCESS, "Perform ECDH with public points on non-generator subgroup.", ecdhTests.toArray(new Test[0])); - Random r = new Random(); - byte[] raw = new byte[128]; - byte[] sig = new byte[40]; - r.nextBytes(raw); - r.nextBytes(sig); - - List<Test> ecdsaTests = new LinkedList<>(); - for (EC_Key.Public pub : keys) { - Command setCommand = new Command.Set(this.card, ECTesterApplet.KEYPAIR_REMOTE, EC_Consts.CURVE_external, pub.getParams(), pub.flatten()); - Test setTest = CommandTest.expect(setCommand, ExpectedValue.ANY); - Command ecdsaCommand = new Command.ECDSA_verify(this.card, ECTesterApplet.KEYPAIR_REMOTE, EC_Consts.Signature_ALG_ECDSA_SHA, raw, sig); - Test ecdsaTest = CommandTest.expect(ecdsaCommand, ExpectedValue.FAILURE); - ecdsaTests.add(CompoundTest.all(ExpectedValue.SUCCESS, "Verify random ECDSA signature by " + pub.getId() + ".", setTest, ecdsaTest)); - } - Test ecdsa = CompoundTest.all(ExpectedValue.SUCCESS, "Verify random ECDSA signature by public points on non-generator subgroup.", ecdsaTests.toArray(new Test[0])); - - Test tests = CompoundTest.all(ExpectedValue.SUCCESS, "Perform ECDH and ECDSA tests.", ecdh, ecdsa); - if (cfg.cleanup) { Test cleanup = CommandTest.expect(new Command.Cleanup(this.card), ExpectedValue.SUCCESS); - doTest(CompoundTest.greedyAllTry(ExpectedValue.SUCCESS, "Cofactor test of " + curve.getId() + ".", prepare, tests, cleanup)); + doTest(CompoundTest.greedyAllTry(ExpectedValue.SUCCESS, "Cofactor test of " + curve.getId() + ".", prepare, ecdh, cleanup)); } else { - doTest(CompoundTest.greedyAllTry(ExpectedValue.SUCCESS, "Cofactor test of " + curve.getId() + ".", prepare, tests)); + doTest(CompoundTest.greedyAllTry(ExpectedValue.SUCCESS, "Cofactor test of " + curve.getId() + ".", prepare, ecdh)); } } } |
