diff options
| author | J08nY | 2017-11-05 16:48:30 +0100 |
|---|---|---|
| committer | J08nY | 2017-11-05 16:48:30 +0100 |
| commit | daaa7abd91ff8ae12e0b1835045489acbda0539f (patch) | |
| tree | 1a2a944473285359a9af3691f2ce69b608264f12 /src/cz/crcs/ectester/reader/test/CompositeCurvesSuite.java | |
| parent | 16f20afbff36a7e048d24d7e7d1db8657f002c5e (diff) | |
| download | ECTester-daaa7abd91ff8ae12e0b1835045489acbda0539f.tar.gz ECTester-daaa7abd91ff8ae12e0b1835045489acbda0539f.tar.zst ECTester-daaa7abd91ff8ae12e0b1835045489acbda0539f.zip | |
Implement Result.ExpectedValue to add more logic to test evaluation.
- Introduces a new enum Result.ExpectedValue, which is used to
signify what Test results are expected.
- Changes the Result.Value enum to contain information about what
was expected. It gains more values:
- UXSUCCESS -> Unexpected success.
- XFAILURE -> Expected failure.
The values SUCCESS and XFAILURE are the OK, values.
- Creates a hierarchy of evaluating Responses, Simple tests and
Compoung tests.
Simple test evaluates the OK property of the response object
(using .successfull() method) and again exposes its OK property
which depends on the tests ExpectedValue and the response
success.
Compound test evaluates the OK property of the Simple tests it
contains (using the .ok() method) and again exposes its OK
property which depends on the concrete Compound test variant,
but involves some ExpectedValues and the success of the individual
Simple tests it contains.
Diffstat (limited to '')
| -rw-r--r-- | src/cz/crcs/ectester/reader/test/CompositeCurvesSuite.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/cz/crcs/ectester/reader/test/CompositeCurvesSuite.java b/src/cz/crcs/ectester/reader/test/CompositeCurvesSuite.java index c777a77..8e7ca31 100644 --- a/src/cz/crcs/ectester/reader/test/CompositeCurvesSuite.java +++ b/src/cz/crcs/ectester/reader/test/CompositeCurvesSuite.java @@ -12,6 +12,8 @@ import javacard.security.KeyPair; import java.util.Map; +import static cz.crcs.ectester.reader.test.Result.ExpectedValue; + /** * @author Jan Jancar johny@neuromancer.sk */ @@ -39,12 +41,12 @@ public class CompositeCurvesSuite extends TestSuite { continue; } if ((curve.getBits() == cfg.bits || cfg.all)) { - tests.add(new Test.Simple(new Command.Allocate(cardManager, ECTesterApplet.KEYPAIR_BOTH, curve.getBits(), curve.getField()), Result.Value.SUCCESS)); - tests.add(new Test.Simple(new Command.Set(cardManager, ECTesterApplet.KEYPAIR_BOTH, EC_Consts.CURVE_external, curve.getParams(), curve.flatten()), Result.Value.ANY)); - tests.add(new Test.Simple(new Command.Generate(cardManager, ECTesterApplet.KEYPAIR_LOCAL), Result.Value.ANY)); + tests.add(new Test.Simple(new Command.Allocate(cardManager, ECTesterApplet.KEYPAIR_BOTH, curve.getBits(), curve.getField()), ExpectedValue.SUCCESS)); + tests.add(new Test.Simple(new Command.Set(cardManager, ECTesterApplet.KEYPAIR_BOTH, EC_Consts.CURVE_external, curve.getParams(), curve.flatten()), ExpectedValue.ANY)); + tests.add(new Test.Simple(new Command.Generate(cardManager, ECTesterApplet.KEYPAIR_LOCAL), ExpectedValue.ANY)); Command ecdhCommand = new Command.ECDH_direct(cardManager, ECTesterApplet.KEYPAIR_LOCAL, ECTesterApplet.EXPORT_FALSE, EC_Consts.CORRUPTION_NONE, EC_Consts.KA_ECDH, key.flatten()); - tests.add(new Test.Simple(ecdhCommand, Result.Value.FAILURE, "Card correctly rejected to do ECDH over a composite order curve.", "Card incorrectly does ECDH over a composite order curve, leaks bits of private key.")); - tests.add(new Test.Simple(new Command.Cleanup(cardManager), Result.Value.ANY)); + tests.add(new Test.Simple(ecdhCommand, ExpectedValue.FAILURE, "Card correctly rejected to do ECDH over a composite order curve.", "Card incorrectly does ECDH over a composite order curve, leaks bits of private key.")); + tests.add(new Test.Simple(new Command.Cleanup(cardManager), ExpectedValue.ANY)); } } } |
