diff options
Diffstat (limited to 'standalone/src/test/java/cz')
| -rw-r--r-- | standalone/src/test/java/cz/crcs/ectester/standalone/AppTests.java | 84 |
1 files changed, 80 insertions, 4 deletions
diff --git a/standalone/src/test/java/cz/crcs/ectester/standalone/AppTests.java b/standalone/src/test/java/cz/crcs/ectester/standalone/AppTests.java index de1d9b0..1fdde0c 100644 --- a/standalone/src/test/java/cz/crcs/ectester/standalone/AppTests.java +++ b/standalone/src/test/java/cz/crcs/ectester/standalone/AppTests.java @@ -2,8 +2,6 @@ package cz.crcs.ectester.standalone; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; -import org.junitpioneer.jupiter.ExpectedToFail; -import org.junitpioneer.jupiter.StdErr; import org.junitpioneer.jupiter.StdIo; import org.junitpioneer.jupiter.StdOut; @@ -53,8 +51,6 @@ public class AppTests { @SuppressWarnings("JUnitMalformedDeclaration") @ParameterizedTest - // TODO: @ExpectedToFail does not work with parameterized tests: https://github.com/junit-pioneer/junit-pioneer/issues/762 - @ExpectedToFail @ValueSource(strings = {"Bouncy", "Sun", "libtomcrypt", "Botan", "Crypto++", "OpenSSL 3", "BoringSSL", "libgcrypt", "mbed TLS", "2021" /* IPPCP */, "Nettle", "LibreSSL", "wolfCrypt"}) @StdIo() public void defaultSuite(String libName, StdOut out) { @@ -68,4 +64,84 @@ public class AppTests { System.err.printf("%s: Default suite has exceptions.%n", libName); } } + + @SuppressWarnings("JUnitMalformedDeclaration") + @ParameterizedTest + @ValueSource(strings = {"Bouncy", "Sun", "libtomcrypt", "Botan", "Crypto++", "OpenSSL 3", "BoringSSL", "libgcrypt", "mbed TLS", "2021" /* IPPCP */, "Nettle", "LibreSSL", "wolfCrypt"}) + @StdIo() + public void generate(String libName, StdOut out) { + String[] args = new String[]{"generate", "-n", "10", "-nc", "secg/secp256r1", libName}; + switch (libName) { + case "Botan": + case "Crypto++": + args = new String[]{"generate", "-n", "10", "-nc", "secg/secp256r1", "-t", "ECDH", libName}; + break; + case "Nettle": + case "libgcrypt": + args = new String[]{"generate", "-n", "10", "-cn", "secp256r1", libName}; + break; + case "BoringSSL": + args = new String[]{"generate", "-n", "10", "-cn", "prime256v1", libName}; + break; + } + ECTesterStandalone.main(args); + } + + @SuppressWarnings("JUnitMalformedDeclaration") + @ParameterizedTest + @ValueSource(strings = {"Bouncy", "Sun", "libtomcrypt", "Botan", "Crypto++", "OpenSSL 3", "BoringSSL", "libgcrypt", "mbed TLS", "2021" /* IPPCP */, "Nettle", "LibreSSL", "wolfCrypt"}) + @StdIo() + public void ecdh(String libName, StdOut out) { + String[] args = new String[]{"ecdh", "-n", "10", "-nc", "secg/secp256r1", libName}; + switch (libName) { + case "Nettle": + case "libgcrypt": + args = new String[]{"ecdh", "-n", "10", "-cn", "secp256r1", libName}; + break; + case "BoringSSL": + args = new String[]{"ecdh", "-n", "10", "-cn", "prime256v1", libName}; + break; + } + ECTesterStandalone.main(args); + } + + @SuppressWarnings("JUnitMalformedDeclaration") + @ParameterizedTest + @ValueSource(strings = {"Bouncy", "Sun", "libtomcrypt", "Botan", "Crypto++", "OpenSSL 3", "BoringSSL", "libgcrypt", "mbed TLS", "2021" /* IPPCP */, "Nettle", "LibreSSL", "wolfCrypt"}) + @StdIo() + public void ecdsa(String libName, StdOut out) { + String[] args = new String[]{"ecdsa", "-n", "10", "-nc", "secg/secp256r1", libName}; + switch (libName) { + case "Nettle": + case "libgcrypt": + args = new String[]{"ecdsa", "-n", "10", "-cn", "secp256r1", "-t", "NONEwithECDSA", libName}; + break; + case "BoringSSL": + args = new String[]{"ecdsa", "-n", "10", "-cn", "prime256v1", "-t", "NONEwithECDSA", libName}; + break; + case "OpenSSL 3": + case "libtomcrypt": + case "LibreSSL": + case "2021": + args = new String[]{"ecdsa", "-n", "10", "-nc", "secg/secp256r1", "-t", "NONEwithECDSA", libName}; + break; + } + ECTesterStandalone.main(args); + } + + @SuppressWarnings("JUnitMalformedDeclaration") + @ParameterizedTest + @ValueSource(strings = {"Bouncy", "Sun", "libtomcrypt", "Botan", "Crypto++", "OpenSSL 3", "BoringSSL", "libgcrypt", "mbed TLS", "2021" /* IPPCP */, "Nettle", "LibreSSL", "wolfCrypt"}) + @StdIo() + public void export(String libName, StdOut out) { + String[] args = new String[]{"export", "-b", "256", libName}; + switch (libName) { + case "Botan": + case "Crypto++": + args = new String[]{"export", "-b", "256", "-t", "ECDH", libName}; + break; + } + ECTesterStandalone.main(args); + System.err.println(out.capturedString()); + } } |
