diff options
| author | J08nY | 2017-04-19 01:10:17 +0200 |
|---|---|---|
| committer | J08nY | 2017-04-19 01:10:17 +0200 |
| commit | a7eef06134bef0861e43261640d61153ebb2a6e5 (patch) | |
| tree | 2ef308843b4e8b1770be6681c15b98dcd78d40ff /src/cz/crcs/ectester/data | |
| parent | f4a66768ed6dfcfd7156ad0c8c364cdbf6e45e9c (diff) | |
| download | ECTester-a7eef06134bef0861e43261640d61153ebb2a6e5.tar.gz ECTester-a7eef06134bef0861e43261640d61153ebb2a6e5.tar.zst ECTester-a7eef06134bef0861e43261640d61153ebb2a6e5.zip | |
Refactor testing, add Config class, make EC_Data read bytes
- The ECTester.Config class now stores and reads all CLI options
- Testing with the -t / --test option was partially refactored
into:
- Test:
Encapsulates one Command and Response pair with expected result,
a real result and a callback to dynamically assign result
- TestSuite:
Encapsulates a bunch of tests, represents a whole category of
tests either that can be run on any curve or only on some.
Diffstat (limited to 'src/cz/crcs/ectester/data')
| -rw-r--r-- | src/cz/crcs/ectester/data/EC_Store.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/cz/crcs/ectester/data/EC_Store.java b/src/cz/crcs/ectester/data/EC_Store.java index 0571cd8..ccd3586 100644 --- a/src/cz/crcs/ectester/data/EC_Store.java +++ b/src/cz/crcs/ectester/data/EC_Store.java @@ -151,12 +151,13 @@ public class EC_Store { } short bitsize = Short.parseShort(bits.getTextContent()); - EC_Curve curve = new EC_Curve(bitsize, alg, descs); + EC_Curve curve = new EC_Curve(id.getTextContent(), bitsize, alg, descs); InputStream csv = parseDataElement(dir, curveElem); if (!curve.readCSV(csv)) { throw new IOException("Invalid csv data."); } + csv.close(); objMap.put(id.getTextContent(), curve); } else { @@ -233,12 +234,13 @@ public class EC_Store { kab = EC_Consts.KA_ECDHC; } - EC_KAResult kaResult = new EC_KAResult(kab, curve.getTextContent(), onekey.getTextContent(), otherkey.getTextContent(), descs); + EC_KAResult kaResult = new EC_KAResult(id.getTextContent(), kab, curve.getTextContent(), onekey.getTextContent(), otherkey.getTextContent(), descs); InputStream csv = parseDataElement(dir, elem); if (!kaResult.readCSV(csv)) { throw new IOException("Invalid csv data."); } + csv.close(); objMap.put(id.getTextContent(), kaResult); } else { @@ -276,6 +278,8 @@ public class EC_Store { if (!result.readCSV(csv)) { throw new IOException("Invalid CSV data."); } + csv.close(); + return result; } |
