Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
016a8e9
feat: improve readme documentation with new sections: What you get, U…
petrs Feb 22, 2026
2e2e75b
feat: Improved help and logging messages
petrs Feb 22, 2026
638f7f4
feat: improved exception handling
petrs Feb 22, 2026
f165942
feat: update nbproject build files
petrs Feb 25, 2026
e0b9392
chore: cleaning unsued/untracked stuff
petrs Feb 25, 2026
ef25308
feat: add additional parsing of cplc info
petrs Feb 25, 2026
36044a0
ci: updat run scripts
petrs Feb 25, 2026
28976e0
docs: adding relevant info
petrs Feb 25, 2026
2bfc328
Merge branch 'master' into devel
petrs Feb 25, 2026
03f6467
fix: revert changes of the directory in run.bat
xhanulik Jun 30, 2026
a657665
fix: build AlgTest_Process after AlgTest_JClient automatically
xhanulik Jun 30, 2026
0489676
fix: remove backup file
xhanulik Jun 30, 2026
0fda6d1
feat: replace NetBeans/nbproject build with self-contained Ant scripts
xhanulik Jun 30, 2026
b9d3865
docs: fix typos and grammatical errors
xhanulik Jun 30, 2026
f640639
fix: do not generate log file when printing help message
xhanulik Jun 30, 2026
ace0a19
fix: do not print testing completion message before measuring
xhanulik Jun 30, 2026
a435b3c
fix: remove unused dist/ directory
xhanulik Jun 30, 2026
ec41729
fix: incorrect mode tag name
xhanulik Jun 30, 2026
f56b54e
fix: update documentation when testing hangs
xhanulik Jun 30, 2026
7470aea
docs: add documentation for building from source
xhanulik Jun 30, 2026
e9de0e3
fix: state explicit output directory for results
xhanulik Jul 1, 2026
c01bc61
docs: add initial deployment docs
xhanulik Jul 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/!!!temp/
/heap/
/AlgTest_JavaCard/nbproject/private/*
/AlgTest_JavaCard/!uploader/*
/AlgTest_JavaCard/build/*
Expand All @@ -12,7 +13,8 @@
/AlgTest_JClient/test/*.jar
/AlgTest_JClient/dist/*
/AlgTest_JClient/nbproject/*

/AlgTest_JClient/*.log
/AlgTest_JClient/store/*

/AlgTest_Process/dist/*
/AlgTest_Process/test-output/*
Expand Down
1 change: 1 addition & 0 deletions AlgTest_JClient/nbproject/build-impl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ is divided into following sections:

-->
<project xmlns:if="ant:if" xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" xmlns:unless="ant:unless" basedir=".." default="default" name="AlgTestJClient-impl">
<import file="build-native.xml"/>
<fail message="Please build using Ant 1.8.0 or higher.">
<condition>
Comment thread
xhanulik marked this conversation as resolved.
Outdated
<not>
Expand Down
6 changes: 3 additions & 3 deletions AlgTest_JClient/nbproject/genfiles.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ build.xml.script.CRC32=04cacdaf
build.xml.stylesheet.CRC32=8064a381@1.68.1.46
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=168c3420
nbproject/build-impl.xml.script.CRC32=eefd4347
nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.100.0.48
nbproject/build-impl.xml.data.CRC32=62d418e4
nbproject/build-impl.xml.script.CRC32=098dc93d
nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.101.0.48
7 changes: 4 additions & 3 deletions AlgTest_JClient/nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ file.reference.is-native-c.jar=libs\\JNA\\is-native-c.jar
file.reference.is-runtime.jar=libs\\JNA\\is-runtime.jar
file.reference.jcardsim-2.2.2-all.jar=test\\jcardsim-2.2.2-all.jar
file.reference.jcardsim-3.0.4.jar=jcardsim-3.0.4.jar
file.reference.jcardsim-3.0.5-SNAPSHOT.jar=..\\libs\\jcardsim-3.0.5-SNAPSHOT.jar
file.reference.jcardsim-3.0.6.0.jar=libs/jcardsim-3.0.6.0.jar
file.reference.jcommander-1.81.jar=../libs/jcommander-1.81.jar
file.reference.jctasks.jar=libs\\JNA\\jctasks.jar
file.reference.jna-4.1.0.jar=libs\\JNA\\jna-4.1.0.jar
Expand All @@ -55,9 +55,9 @@ javac.classpath=\
${file.reference.jna-4.1.0.jar}:\
${file.reference.jna-platform-4.1.0.jar}:\
${file.reference.jna.jar}:\
${file.reference.jcardsim-3.0.5-SNAPSHOT.jar}:\
${file.reference.jcommander-1.81.jar}:\
${file.reference.jcommander-1.81.jar}
${file.reference.jcommander-1.81.jar}:\
Comment thread
xhanulik marked this conversation as resolved.
Outdated
${file.reference.jcardsim-3.0.6.0.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
Expand Down Expand Up @@ -114,6 +114,7 @@ manifest.custom.permissions=
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
native.bundling.enabled=true
platform.active=default_platform
run.classpath=\
${javac.classpath}:\
Expand Down
3 changes: 3 additions & 0 deletions AlgTest_JClient/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<buildExtensions xmlns="http://www.netbeans.org/ns/ant-build-extender/1">
<extension file="build-native.xml" id="j2sedeploy"/>
</buildExtensions>
Comment thread
xhanulik marked this conversation as resolved.
Outdated
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>AlgTestJClient</name>
<source-roots>
Expand Down
56 changes: 52 additions & 4 deletions AlgTest_JClient/src/algtestjclient/AlgTestJClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class AlgTestJClient {
* Version 1.8.3 (10.02.2026)
* - Fix incorrect testing of OneShot engines
* - print used command line arguments into log
* - More detailed help
*/
public final static String ALGTEST_JCLIENT_VERSION = "1.8.3";
/**
Expand Down Expand Up @@ -200,6 +201,20 @@ public class AlgTestJClient {

static DirtyLogger m_SystemOutLogger = null;
public static void main(String[] args) throws IOException, Exception {
try {
runMain(args);
} catch (Exception ex) {
System.err.println("\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
System.err.println("Unexpected error: " + ex.getMessage());
System.err.println("\nIf this error is unexpected, please report it at:");
System.err.println(" https://github.com/crocs-muni/JCAlgTest/issues");
System.err.println("Include: your OS, Java version, card ATR, and the .log file from this directory.");
System.err.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
throw ex;
}
}

static void runMain(String[] args) throws IOException, Exception {
Map<String, String> tempInfo = new HashMap<>();

Args cmdArgs = new Args();
Expand All @@ -221,7 +236,7 @@ public static void main(String[] args) throws IOException, Exception {
FileOutputStream systemOutLogger = new FileOutputStream(logFileName);
tempInfo.put("out_file_name", logFileName);
allResultsMap.put("main", tempInfo);
m_SystemOutLogger = new DirtyLogger(systemOutLogger, true);
m_SystemOutLogger = new DirtyLogger(systemOutLogger, true, cmdArgs.verbose);

m_SystemOutLogger.print("Command line arguments: ");
for (int i = 0; i < args.length; i++) {
Expand All @@ -245,7 +260,8 @@ public static void main(String[] args) throws IOException, Exception {
m_SystemOutLogger.println();

if (cmdArgs.help) {
JCommander.newBuilder().addObject(cmdArgs).build().usage();
JCommander.newBuilder().addObject(cmdArgs).build().usage();
printHelpExtras();
return;
}

Expand Down Expand Up @@ -364,9 +380,37 @@ else if (operation.compareTo(Args.OP_ALG_FINGERPRINT) == 0) {

if (cmdArgs.selftest) {
checkSelfTestResults(allResultsMap);
}
}
}


static void printHelpExtras() {
System.out.println("\nExamples:");
System.out.println(" # Interactive mode — prompts for reader and test selection:");
System.out.println(" java -jar AlgTestJClient.jar\n");
System.out.println(" # Interactive mode with simulator — prompts for test selection with simulated card as target:");
System.out.println(" java -jar AlgTestJClient.jar -simulator\n");
System.out.println(" # Test which algorithms the card supports (non-interactive):");
System.out.println(" java -jar AlgTestJClient.jar -op ALG_SUPPORT_EXTENDED -cardname MyCard -fresh\n");
System.out.println(" # Fixed-length performance benchmark:");
System.out.println(" java -jar AlgTestJClient.jar -op ALG_PERFORMANCE_STATIC -cardname MyCard -fresh\n");
System.out.println(" # Variable-length performance benchmark, save results to /tmp/:");
System.out.println(" java -jar AlgTestJClient.jar -op ALG_PERFORMANCE_VARIABLE -cardname MyCard -fresh -outpath /tmp/\n");
System.out.println(" # Show full per-algorithm detail on console:");
System.out.println(" java -jar AlgTestJClient.jar -op ALG_SUPPORT_EXTENDED -cardname MyCard -fresh -verbose\n");
System.out.println("Common problems:");
System.out.println(" Card not found -- Is the PC/SC daemon running? On Linux: sudo pcscd");
System.out.println(" On Linux you may also need:");
System.out.println(" -Dsun.security.smartcardio.library=/usr/lib64/libpcsclite.so.1");
System.out.println(" Testing hangs -- The card may not support this algorithm; see KNOWN_ISSUES.md.");
System.out.println(" Re-insert the card and re-run with -fresh to skip ahead.");
System.out.println(" Results incomplete -- Re-run with -fresh to discard partial results and start over.");
Comment thread
xhanulik marked this conversation as resolved.
Outdated
System.out.println(" Console too noisy -- Run with -verbose only when debugging; default shows high-level");
System.out.println(" progress only; full detail is always saved to the .log file.\n");
System.out.println("Reporting bugs:");
System.out.println(" https://github.com/crocs-muni/JCAlgTest/issues");
System.out.println(" Include: OS, Java version, card ATR, and the .log file from this directory.\n");
}

static long getStartTime() {
if (m_appStartTime == 0) {
m_appStartTime = System.currentTimeMillis();
Expand All @@ -375,6 +419,10 @@ static long getStartTime() {
}

static void printSendRequest() {
System.out.println("\n=========================================");
System.out.println("Testing complete.");
System.out.println("Results written to the current directory (*.csv and *.log).");
System.out.println("=========================================");
Comment thread
xhanulik marked this conversation as resolved.
Outdated
Comment thread
xhanulik marked this conversation as resolved.
System.out.println("\n-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");
System.out.println("KIND REQUEST: Please consider sending us your results to extend info openly");
System.out.println("available to all JavaCard enthusiasts at http://jcalgtest.org.");
Expand Down
5 changes: 4 additions & 1 deletion AlgTest_JClient/src/algtestjclient/Args.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,8 @@ public class Args {

@Parameter(names = "-selftest", description = "Executes selftesting using simulator as target.")
public boolean selftest = false;


@Parameter(names = "-verbose", description = "Show detailed per-algorithm output on console (default: detail is written to log file only)")
public boolean verbose = false;

}
33 changes: 32 additions & 1 deletion AlgTest_JClient/src/algtestjclient/DirtyLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,19 @@ may be distributed under the terms of the GNU General Public License (GPL),
public class DirtyLogger {
FileOutputStream m_logFile;
boolean m_bOutputSystemOut = true;
boolean m_verbose = false;

public DirtyLogger(FileOutputStream logFile, boolean bOutputSystemOut) {
m_logFile = logFile;
m_bOutputSystemOut = bOutputSystemOut;
}

public DirtyLogger(FileOutputStream logFile, boolean bOutputSystemOut, boolean verbose) {
m_logFile = logFile;
m_bOutputSystemOut = bOutputSystemOut;
m_verbose = verbose;
}

public void println() {
String logLine = "\n";
print(logLine);
Expand All @@ -62,5 +71,27 @@ public void print(String logLine) {
} catch (IOException ex) {
}
}
}
}

/**
* Detail-level output: always written to the log file, but printed to
* the console only when the -verbose flag is active. Use this for
* per-algorithm APDU traces and low-level status lines that would
* otherwise flood the console during a long test run.
*/
public void printlnDetail(String logLine) {
printDetail(logLine + "\n");
}

public void printDetail(String logLine) {
if (m_bOutputSystemOut && m_verbose) {
System.out.print(logLine);
}
if (m_logFile != null) {
try {
m_logFile.write(logLine.getBytes());
} catch (IOException ex) {
}
}
}
}
37 changes: 24 additions & 13 deletions AlgTest_JClient/src/algtestjclient/PerformanceTesting.java
Original file line number Diff line number Diff line change
Expand Up @@ -518,10 +518,11 @@ void finalizeMeasurement(Map<String, String> results) throws IOException {
}
if (results != null) { results.put("errors_observed", String.format("%d", totalErrors)); }

message = "\n\nCard used: " + m_cardName;
message = "\n\nCard used: " + m_cardName;
m_SystemOutLogger.println(message);

}

void LoadAlreadyMeasuredAlgs(String cardName, String testType, boolean bForceFreshmeasurement) {
String filePath = testType + "_already_measured.list";
String filePathOld = filePath + ".old";
Expand Down Expand Up @@ -965,28 +966,38 @@ public double perftest_measure(byte appletCLA, byte appletPrepareINS, byte apple
return -1;
}
catch (Exception ex) {
// Unexpected exception
m_SystemOutLogger.println(ex.toString() + "\n");
numFailedRepeats++;

// Unexpected exception — likely card removed or communication failure
String exClass = ex.getClass().getSimpleName();
boolean isCardRemoved = (ex instanceof javax.smartcardio.CardNotPresentException)
|| exClass.contains("CardNotPresent")
|| (ex.getMessage() != null && (ex.getMessage().contains("SCARD_E_NO_SMARTCARD")
|| ex.getMessage().contains("no card")));
if (isCardRemoved) {
m_SystemOutLogger.println("ERROR: Card removed or communication lost during '" + info + "'. Attempting to reconnect...");
} else {
m_SystemOutLogger.println("ERROR: Unexpected exception (" + exClass + ") during '" + info + "': " + ex.getMessage());
}
numFailedRepeats++;

if (numFailedRepeats == 1) {
// For first fail, try to reconnect to card automatically
try {
m_numReconnects++;
m_cardManager.ConnectToCard();
}
catch (Exception ex2) {
m_SystemOutLogger.println(ex2.toString());
m_SystemOutLogger.println(ex2.toString());
numFailedRepeats++;
}
}

if (numFailedRepeats > 1) {
// For second fail, ask user
m_SystemOutLogger.println("ERROR: unable to measure operation '" + info + "' properly because of exception (" + ex.toString() + ")");
m_SystemOutLogger.println("Current reader is: " + m_cardManager.getTerminalName());
m_SystemOutLogger.println("Current card is: " + m_cardName + " - " + m_cardManager.getATR());
m_SystemOutLogger.println("Try to physically remove card and/or upload applet manually and insert it again. Press 'r' to retry or 's' to skip this algorithm (if retry fails)\n");
// For second fail, ask user
m_SystemOutLogger.println("ERROR: Unable to measure '" + info + "' after reconnect attempt.");
m_SystemOutLogger.println("Current reader: " + m_cardManager.getTerminalName());
m_SystemOutLogger.println("Current card: " + m_cardName + " - " + m_cardManager.getATR());
m_SystemOutLogger.println("ACTION REQUIRED: Re-insert the card (or power-cycle it), then press:");
m_SystemOutLogger.println(" 'r' to retry this algorithm 's' to skip it and continue\n");
Scanner sc = new Scanner(System.in);
String answ = sc.next();
m_SystemOutLogger.println(String.format("%s", answ));
Expand Down
Binary file removed AlgTest_JClient/store/AlgTestJClient.jar
Binary file not shown.
Binary file removed AlgTest_JavaCard/!uploader/AlgTest_222.cap
Binary file not shown.
8 changes: 5 additions & 3 deletions AlgTest_Process/cplc.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,16 +191,18 @@ def get_ictype_name(icfab, ictype):
if ictype.find('0015') != -1: return 'Philips P8WE5032' # Philips P8WE5032, https://www.commoncriteriaportal.org/files/epfiles/2000_06.pdf
if icfab.find('0005') != -1:
if ictype.find('0045') != -1: return 'Infineon M7892 B11' # https://csrc.nist.gov/csrc/media/projects/cryptographic-module-validation-program/documents/security-policies/140sp2327.pdf
if icfab.find('0005') != -1:
if ictype.find('0045') != -1: return 'Infineon M7892 B11' # https://csrc.nist.gov/csrc/media/projects/cryptographic-module-validation-program/documents/security-policies/140sp2327.pdf
if icfab.find('008c') != -1:
if ictype.find('0089') != -1: return 'Tongxin THD89' # https://www.commoncriteriaportal.org/files/epfiles/2017-28%20INF-2492.pdf
if icfab.find('4070') != -1:
if icfab.find('4070') != -1 or icfab.find('4790') != -1:
if ictype.find('5072') != -1: return 'NXP P5CD144' # https://csrc.nist.gov/csrc/media/projects/cryptographic-module-validation-program/documents/security-policies/140sp2774.pdf
if ictype.find('5167') != -1: return 'NXP P5CC081V1A' # https://csrc.nist.gov/csrc/media/projects/cryptographic-module-validation-program/documents/security-policies/140sp2774.pdf
if ictype.find('5168') != -1: return 'NXP P5CD081V1A' # https://csrc.nist.gov/csrc/media/projects/cryptographic-module-validation-program/documents/security-policies/140sp2774.pdf
if icfab.find('5354') != -1:
if ictype.find('0033') != -1: return 'STM ST31 ARM' # Feitian D11CR https://docs.google.com/spreadsheets/d/10s3dA_qGvWMajv8RhCWa00x-h-1Dx6SdF9rEKN-1RIg/edit#gid=952816161
if icfab.find('4180') != -1:
if ictype.find('0106') != -1: return 'Atmel AT90SC25672RCT' # https://csrc.nist.gov/CSRC/media/projects/cryptographic-module-validation-program/documents/security-policies/140sp925.pdf
if ictype.find('0107') != -1: return 'Atmel AT90SC12872RCFT Revision M' # https://sec-certs.org/fips/ee14860f6bd0506d/target.pdf
if ictype.find('010b') != -1: return 'Atmel AT90SC28872RCU Revision G' # https://sec-certs.org/fips/311ba2ed6a5b4105/target.pdf
return ''


Expand Down
4 changes: 3 additions & 1 deletion AlgTest_Process/nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,16 @@ dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
file.reference.AlgTestJClient.jar=..\\AlgTest_JClient\\dist\\AlgTestJClient.jar
file.reference.AlgTestJClient.jar-1=..\\libs\\AlgTestJClient.jar
file.reference.json-simple-1.1.1.jar=..\\libs\\json-simple-1.1.1.jar
includes=**
jar.archive.disabled=${jnlp.enabled}
jar.compress=false
jar.index=${jnlp.enabled}
javac.classpath=\
${file.reference.AlgTestJClient.jar}:\
${file.reference.json-simple-1.1.1.jar}
${file.reference.json-simple-1.1.1.jar}:\
${file.reference.AlgTestJClient.jar-1}
# Space-separated list of extra javac options
Comment thread
xhanulik marked this conversation as resolved.
Outdated
javac.compilerargs=
javac.deprecation=false
Expand Down
10 changes: 5 additions & 5 deletions AlgTest_Process/run.bat
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
java -jar ..\AlgTest_Process\dist\AlgTestProcess.jar ..\..\algtest_results\javacard\Profiles HTML

java -jar ..\AlgTest_Process\dist\AlgTestProcess.jar ..\..\algtest_results\javacard\Profiles\performance\fixed\ SIMILARITY ..\..\algtest_results\javacard\web\
java -jar ..\AlgTest_Process\dist\AlgTestProcess.jar ..\..\algtest_results\javacard\Profiles\performance\fixed\ JCINFO ..\..\algtest_results\javacard\web\
java -jar ..\AlgTest_Process\dist\AlgTestProcess.jar ..\..\algtest_results\javacard\Profiles\performance\fixed\ SORTABLE ..\..\algtest_results\javacard\web\
java -jar ..\AlgTest_Process\dist\AlgTestProcess.jar ..\..\algtest_results\javacard\Profiles\performance\fixed\ RADAR ..\..\algtest_results\javacard\web\
java -jar ..\AlgTest_Process\dist\AlgTestProcess.jar ..\..\algtest_results\javacard\Profiles\performance\variable\ SCALABILITY ..\..\algtest_results\javacard\web\
java -jar ..\AlgTest_Process\dist\AlgTestProcess.jar ..\..\algtest_results\javacard\Profiles\performance\fixed\ SIMILARITY ..\..\algtest_web\javacard\web\
java -jar ..\AlgTest_Process\dist\AlgTestProcess.jar ..\..\algtest_results\javacard\Profiles\performance\fixed\ JCINFO ..\..\algtest_web\javacard\web\
java -jar ..\AlgTest_Process\dist\AlgTestProcess.jar ..\..\algtest_results\javacard\Profiles\performance\fixed\ SORTABLE ..\..\algtest_web\javacard\web\
java -jar ..\AlgTest_Process\dist\AlgTestProcess.jar ..\..\algtest_results\javacard\Profiles\performance\fixed\ RADAR ..\..\algtest_web\javacard\web\
java -jar ..\AlgTest_Process\dist\AlgTestProcess.jar ..\..\algtest_results\javacard\Profiles\performance\variable\ SCALABILITY ..\..\algtest_web\javacard\web\
Comment thread
xhanulik marked this conversation as resolved.
Outdated



Loading