
ECTester is a tool for testing and analysis of elliptic curve cryptography implementations on JavaCards and in
cryptographic libraries. It consists of four separate parts:
- The ECTester applet, a JavaCard applet that provides the testing interface
- The ECTesterReader app, a reader app that works with the applet
- The ECTesterStandalone app, which tests software cryptographic libraries
- Jupyter notebooks for analysis and visualization of data from the apps
For more information on ECC support on JavaCards see the GitHub page, with results, tables and docs.
This project is developed by the Centre for Research On Cryptography and Security at Faculty of Informatics, Masaryk University.
[!NOTE]
The artifact for the CHES 2025 paper "ECTester: Reverse-engineering side-channel countermeasures of ECC implementations" is under the analysis/countermeasures/ directory.
Contents
Other documentation
- TESTS: Description of card test suites.
- CURVES: Description of curve and test data contained in ECTester.
- FORMAT: Description of input and output formats used by ECTester.
- LIBS: List of cryptographic libraries supported by ECTester and their characteristics.
- VULNS: List of vulnerabilities discovered using ECTester.
Setup
ECTester uses Gradle (and Gradle wrapper) for its build.
There are three parts of ECTester, the JavaCard applet used for testing, the reader app which controls it and the
standalone app which tests software libraries. The target platform for ECTester is Linux, but things should work on
Windows as well, although testing of standalone libraries will be limited to Java libraries and Microsoft CNG library.
The ECTester parts require different Java versions. Reader and standalone parts require Java >= 15 while the applet build
will be able to target different JavaCard versions based on the Java version, see this list.
The very first time, to clone and initialize the repository at once, do:
git clone --recurse-submodules https://github.com/crocs-muni/ectester.git
cd ectester
Or, if you've cloned the repository in the past with git clone https://github.com/crocs-muni/ectester.git,
you can initialize the submodules, i.e., JavaCard SDKs, Microsoft CNG, BoringSSL, etc., with:
cd ectester
git submodule update --init --recursive
Then, to build ECTester do:
./gradlew :applet:buildJavaCard # To build the applet (cap) -> "applet/build/javacard/applet[221,222,305].cap".
./gradlew :reader:uberJar # To build the reader tool (jar) -> "reader/build/libs/ECTesterReader.jar"
./gradlew :standalone:libs # To build the native library shims.
./gradlew :standalone:uberJar # To build the standalone tool (jar) -> "standalone/build/libs/ECTesterStandalone.jar"
The applet comes in several flavors, targeting JavaCard 2.2.1, 2.2.2, 3.0.5, and 3.2.0. The 2.2.2 and later flavors
support extended length APDUs which are necessary for some commands to work properly.
Which flavor you can build depends on which Java JDK version you have, see this list
or the applet build.gradle.
To build the standalone part, which involves numerous cryptographic libraries, one has two options.
- Install these cryptographic libraries system-wide and let the build use those.
- Use Nix to build the tool part with given library versions.
See the section on setup of standalone library testing for more details.
JavaCard testing
The JavaCard part of ECTester targets testing elliptic curve cryptography implementations in programmable smart cards of the JavaCard platform, version 2.2.1 and up. The reader app supports many actions, the main one being testing: the running of predetermined test suites that test the JavaCard for support, performance and vulnerabilities. The other actions focus on data collection, generating keys, signing data, performing key agreement or exporting the preset curves, output of the mentioned actions can then be analyzed using the Jupyter notebooks, see analysis.
- Upload
applet/build/applet/ectester[221,222,305,320].cap using your favorite tool (e.g., GlobalPlatformPro tool).
- Run
java -jar reader/build/libs/ECTesterReader.jar -t or other data collection commands.
- Inspect output log with annotated results.
Following operations are tested in the default test suite, which is just a basic support test suite:
- Allocation of new KeyPair class for specified parameters
- Generation of KeyPair with default curve
- Setting of custom curve and KeyPair generation
- Generation of shared secret via ECDH
- Signature via ECDSA
See java -jar ECTesterReader.jar -h, java -jar ECTesterReader.jar -ls and TESTS for more.
Actions
Actions for the reader app, exactly one of which is required for every run.
Test
-t / --test [test_suite]
Perform support, performance and vulnerability tests of ECC.
Currently supported test suites include:
default
test-vectors
compression
miscellaneous
signature
wrong*
invalid*
twist*
degenerate*
composite*
cofactor*
edge-cases*
*NOTE: The wrong, composite, invalid,twist, cofactor, edge-cases and degenerate test suites caused temporary/permanent DoS of some cards. These test suites prompt you for
confirmation before running, be cautious.
To select which tests will be performed, it is possible to enter the test suite name with a suffix
which specifies the number of the first test to be run, and optionally the number of the last test to be run as -t <test_suite>[:start_index[:stop_index]].
Use with -o / --output [out_type:]<out_file> to output the test results to a file.
Use -n / --number to repeat tests multiple times (for example if you want more information on timings).
Use -ts / --test-shuffle to shuffle the tests in the test suite.
Use --cleanup to issue a JavaCard cleanup command after each group of tests (JCSystem.requestObjectDeletion()).
For possible formats of this file see FORMAT.
For more info about the test suites see TESTS.
Export
-e / --export
Exports the default curves (if any) that are preset on the card.
Use with -o / --output [out_file] to output the curve parameters to a file.
For format of this file see FORMAT.
Generate
-g / --generate [amount]
Generates batch of EC keypairs and exports them.
Use with -o / --output [out_file] to output the generated keys to a file.
Use with --time to measure time as a difference of real duration of the operation and the dry-run duration of the operation.
Use --time-unit [milli, micro, nano] to specify the time unit of the output.
For format of this file see FORMAT.
ECDH
-dh / --ecdh [count]
Performs ECDH.
Use with -o / --output [out_file] to output into a file.
Use with --time to measure time as a difference of real duration of the operation and the dry-run duration of the operation.
Use --time-unit [milli, micro, nano] to specify the time unit of the output.
For format of this file see FORMAT.
Respects the KeyAgreement type specified in -ka / --ka-type [type].
ECDSA
-dsa / --ecdsa [count]
Performs ECDSA.
Useful with -i / --input [in_file] to sign the contents of a file.
Use with -o / --output [out_file] to output into a file.
Use with --time to measure time as a difference of real duration of the operation and the dry-run duration of the operation.
Use --time-unit [milli, micro, nano] to specify the time unit of the output.
For format of these files see FORMAT.
Respects the Signature type specified in -sig / --sig-type [type].
List named curves
-ln / --list-named [category/name]
Lists categories of curves, keys and keypairs embedded in ECTester's jar, along with some information about them.
These can be used as arguments to the -n[c|k|pub|priv] / --named-[curve|key|public|private] parameters, using the format: category/name.
For example:
secg/secp192r1 identifies the SECG 192 bit prime field curve known as secp192r1.
For more info about the curves and curve categories see CURVES.
List test suites
-ls / --list-suites
Lists the implemented test suites and gives their short description.
Get applet info
-nf / --info
Get and print ECTester applet info from an applet installed on a card.
Outputs:
- Card ATR
- Negotiated protocol (T=0/T=1)
- ECTester applet version
- ECTester APDU support (basic/extended APDU)
- JavaCard API version
- JavaCard cleanup support
- ECTester internal array sizes and APDU buffer size
Examples
Snippet below shows running the default test suite while simulating(-s), so using JCardSim.
This shows that JCardsim simulates 112b Fp support with default curve present and supports ECDH, ECDHC and ECDSA.