From a45fa0d3cde29728a252c2ca5b7ed4f3e6c87849 Mon Sep 17 00:00:00 2001
From: J08nY
Date: Sun, 12 Nov 2017 13:49:54 +0100
Subject: Separate build files for standalone and reader apps.
---
.gitignore | 10 +-
.travis.yml | 11 +-
README.md | 5 +-
build-applet.xml | 31 +
build-reader.xml | 82 ++
build-standalone.xml | 78 ++
build.xml | 108 --
dist/README.TXT | 34 +-
jcbuild.xml | 31 -
manifest.mf | 4 -
nbproject/build-impl.xml | 1413 --------------------
nbproject/copylibstask.jar | Bin 22335 -> 11902 bytes
nbproject/dist-build.xml | 34 +
nbproject/project.properties | 79 --
nbproject/project.xml | 15 -
nbproject/reader/build-impl.xml | 1413 ++++++++++++++++++++
nbproject/reader/manifest.mf | 4 +
nbproject/reader/project.properties | 79 ++
nbproject/reader/project.xml | 15 +
nbproject/standalone/build-impl.xml | 1413 ++++++++++++++++++++
nbproject/standalone/manifest.mf | 4 +
nbproject/standalone/project.properties | 79 ++
nbproject/standalone/project.xml | 15 +
src/cz/crcs/ectester/common/Util.java | 375 ++++++
src/cz/crcs/ectester/common/ec/EC_Data.java | 2 +-
src/cz/crcs/ectester/common/ec/EC_KAResult.java | 2 +-
src/cz/crcs/ectester/common/ec/EC_Params.java | 2 +-
.../crcs/ectester/common/output/OutputLogger.java | 2 -
.../ectester/common/output/TeeOutputStream.java | 36 +
src/cz/crcs/ectester/common/test/Test.java | 7 +
src/cz/crcs/ectester/reader/CardMngr.java | 1 +
src/cz/crcs/ectester/reader/ECTesterReader.java | 1 +
src/cz/crcs/ectester/reader/Util.java | 375 ------
src/cz/crcs/ectester/reader/command/Command.java | 2 +-
.../ectester/reader/output/ResponseWriter.java | 2 +-
.../ectester/reader/output/TeeOutputStream.java | 36 -
.../crcs/ectester/reader/output/XMLTestWriter.java | 2 +-
.../ectester/reader/output/YAMLTestWriter.java | 2 +-
src/cz/crcs/ectester/reader/response/Response.java | 2 +-
.../crcs/ectester/reader/test/TestVectorSuite.java | 2 +-
src/cz/crcs/ectester/scripts/ectester-reader.bat | 34 +
src/cz/crcs/ectester/scripts/ectester-reader.sh | 48 +
src/cz/crcs/ectester/scripts/ectester.bat | 34 -
src/cz/crcs/ectester/scripts/ectester.sh | 48 -
44 files changed, 3783 insertions(+), 2189 deletions(-)
create mode 100644 build-applet.xml
create mode 100644 build-reader.xml
create mode 100644 build-standalone.xml
delete mode 100644 build.xml
delete mode 100644 jcbuild.xml
delete mode 100644 manifest.mf
delete mode 100644 nbproject/build-impl.xml
create mode 100644 nbproject/dist-build.xml
delete mode 100644 nbproject/project.properties
delete mode 100644 nbproject/project.xml
create mode 100644 nbproject/reader/build-impl.xml
create mode 100644 nbproject/reader/manifest.mf
create mode 100644 nbproject/reader/project.properties
create mode 100644 nbproject/reader/project.xml
create mode 100644 nbproject/standalone/build-impl.xml
create mode 100644 nbproject/standalone/manifest.mf
create mode 100644 nbproject/standalone/project.properties
create mode 100644 nbproject/standalone/project.xml
create mode 100644 src/cz/crcs/ectester/common/Util.java
create mode 100644 src/cz/crcs/ectester/common/output/TeeOutputStream.java
delete mode 100644 src/cz/crcs/ectester/reader/Util.java
delete mode 100644 src/cz/crcs/ectester/reader/output/TeeOutputStream.java
create mode 100644 src/cz/crcs/ectester/scripts/ectester-reader.bat
create mode 100755 src/cz/crcs/ectester/scripts/ectester-reader.sh
delete mode 100644 src/cz/crcs/ectester/scripts/ectester.bat
delete mode 100755 src/cz/crcs/ectester/scripts/ectester.sh
diff --git a/.gitignore b/.gitignore
index fe6a5d3..4724134 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,7 @@
/dist/lib/
-/dist/ECTester.jar
-/dist/ECTester-dist.jar
-/dist/ectester.sh
-/dist/ectester.bat
\ No newline at end of file
+/dist/ECTesterReader.jar
+/dist/ECTesterReader-dist.jar
+/dist/ectester-reader.sh
+/dist/ectester-reader.bat
+/dist/ECTesterStandalone.jar
+/dist/ECTesterStandalone-dist.jar
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index 3959c4d..d599dfb 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,16 +2,19 @@ language: java
jdk:
- oraclejdk8
script:
-- ant -f jcbuild.xml build
-- ant -f build.xml package
+- ant -f build-applet.xml build
+- ant -f build-reader.xml package
+- ant -f build-standalone.xml package
deploy:
provider: releases
api_key:
secure: q2aJvu32K+nfbMR60nFCEkn+jYCKprlCRlIoPjuRz1HySX233Ccwpx1CAdNzEjY6FDFcoReKAg6r5vdPjJ4FRPAQ23TxffIYZPkykL5K/pUZJbM5xkazJY0Fp8i6Vyl0JfeanVib1PTyOSugplhCttFk5nb9JUFV36Tre66XntOl5y80Trn94F5aTlRjfW26UH65W7Aa6WZ0N4OX/ZsX+vEOJPAu+RLfOq9oBOx/loB8ntYM/e/6bEwJp6EedRQLDsiS4NavP3svH+GXsPLs5p3soyRXYsvvGKVnVjcjZURxDDdxv5YuCWUUfl9PbNB+Mqmx/HQxl50BKoKFqwap1+TnlbuTAiWaXeh3zdXuGB+TPg8KE8h6ueDneHd3Lpivgq79IvPWIH+N4b3Pa952+rD+JKBZ807efB+97OtWrkQL7/sLZESQUdIszE724HHOiArKpNajIX+kN6NJdul5xFCiQQHG+O7iDFQBavCGM9fk63mZRyGPxZQzS06BV2vIIHg0yx3igN+OKKMFCH+P3hYR1zL6o65OlgbL1ifTZ18GDvmVRNdi53/fxQ2n/mQmI4tQpn4ZB7Ddoxx4GlpjFjzdKk/P9nKwng0M9wrp8row/vb5S+1aPwSxp9/4ASP9dkvLcNjTkWhmGPrWe+82Y9JPK47uesx0YeaVI2C7IR0=
file:
- - "dist/ECTester-dist.jar"
- - "dist/ECTester.jar"
+ - "dist/ECTesterReader-dist.jar"
+ - "dist/ECTesterReader.jar"
- "!uploader/ectester.cap"
+ - "dist/ECTesterStandalone-dist.jar"
+ - "dist/ECTesterStandalone.jar"
skip_cleanup: true
on:
tags: true
diff --git a/README.md b/README.md
index 5096bd3..0ec59b7 100644
--- a/README.md
+++ b/README.md
@@ -6,8 +6,9 @@ Tests support and behavior of smartcards with JavaCard platform with focus on El
ECTester uses ant.
```bash
-ant package # To build the reader tool (jar).
-ant -f jcbuild.xml build # To build the applet (cap).
+ant -f build-reader.xml package # To build the reader tool (jar).
+ant -f build-standalone.xml package # To build the standalone tool (jar).
+ant -f build-applet.xml build # To build the applet (cap).
```
## Usage
diff --git a/build-applet.xml b/build-applet.xml
new file mode 100644
index 0000000..793060c
--- /dev/null
+++ b/build-applet.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build-reader.xml b/build-reader.xml
new file mode 100644
index 0000000..ec62f6f
--- /dev/null
+++ b/build-reader.xml
@@ -0,0 +1,82 @@
+
+
+
+
+
+
+
+
+
+
+ Builds, tests, and runs the project ECTesterReader.
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/build-standalone.xml b/build-standalone.xml
new file mode 100644
index 0000000..0ba7f93
--- /dev/null
+++ b/build-standalone.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+
+ Builds, tests, and runs the project ECTesterStandalone.
+
+
+
+
+
+
+
+
diff --git a/build.xml b/build.xml
deleted file mode 100644
index f89b743..0000000
--- a/build.xml
+++ /dev/null
@@ -1,108 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- Builds, tests, and runs the project ECTester.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/dist/README.TXT b/dist/README.TXT
index 5d6fa17..64c76a6 100644
--- a/dist/README.TXT
+++ b/dist/README.TXT
@@ -2,31 +2,15 @@
BUILD OUTPUT DESCRIPTION
========================
-When you build an Java application project that has a main class, the IDE
-automatically copies all of the JAR
-files on the projects classpath to your projects dist/lib folder. The IDE
-also adds each of the JAR files to the Class-Path element in the application
-JAR files manifest file (MANIFEST.MF).
+After building (with package target) this directory should contain the files:
-To run the project from the command line, go to the dist folder and
-type the following:
+- ECTesterReader.jar
+- ECTesterReader-dist.jar
+- ECTesterStandalone.jar
+- ECTesterStandalone-dist.jar
+- ectester-reader.sh
+- ectester-reader.bat
-java -jar "ECTester.jar"
+The *-dist.jar variants of JAR files are self-contained executable JAR files with
+all the dependencies inside them.
-To distribute this project, zip up the dist folder (including the lib folder)
-and distribute the ZIP file.
-
-Notes:
-
-* If two JAR files on the project classpath have the same name, only the first
-JAR file is copied to the lib folder.
-* Only JAR files are copied to the lib folder.
-If the classpath contains other types of files or folders, these files (folders)
-are not copied.
-* If a library on the projects classpath also has a Class-Path element
-specified in the manifest,the content of the Class-Path element has to be on
-the projects runtime path.
-* To set a main class in a standard Java project, right-click the project node
-in the Projects window and choose Properties. Then click Run and enter the
-class name in the Main Class field. Alternatively, you can manually type the
-class name in the manifest Main-Class element.
diff --git a/jcbuild.xml b/jcbuild.xml
deleted file mode 100644
index 793060c..0000000
--- a/jcbuild.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/manifest.mf b/manifest.mf
deleted file mode 100644
index cbfea93..0000000
--- a/manifest.mf
+++ /dev/null
@@ -1,4 +0,0 @@
-Manifest-Version: 1.0
-Class-Path: lib/jcardsim-3.0.4-SNAPSHOT.jar lib/commons-cli-1.3.1.jar lib/snakeyaml-1.19.jar
-Main-Class: cz.crcs.ectester.reader.ECTesterReader
-
diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml
deleted file mode 100644
index 3b01c7f..0000000
--- a/nbproject/build-impl.xml
+++ /dev/null
@@ -1,1413 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must set src.dir
- Must set test.src.dir
- Must set build.dir
- Must set dist.dir
- Must set build.classes.dir
- Must set dist.javadoc.dir
- Must set build.test.classes.dir
- Must set build.test.results.dir
- Must set build.classes.excludes
- Must set dist.jar
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must set javac.includes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- No tests executed.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must set JVM to use for profiling in profiler.info.jvm
- Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must select some files in the IDE or set javac.includes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- To run this application from the command line without Ant, try:
-
- java -jar "${dist.jar.resolved}"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must select one file in the IDE or set run.class
-
-
-
- Must select one file in the IDE or set run.class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must select one file in the IDE or set debug.class
-
-
-
-
- Must select one file in the IDE or set debug.class
-
-
-
-
- Must set fix.includes
-
-
-
-
-
-
-
-
-
- This target only works when run from inside the NetBeans IDE.
-
-
-
-
-
-
-
-
- Must select one file in the IDE or set profile.class
- This target only works when run from inside the NetBeans IDE.
-
-
-
-
-
-
-
-
- This target only works when run from inside the NetBeans IDE.
-
-
-
-
-
-
-
-
-
-
-
-
- This target only works when run from inside the NetBeans IDE.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must select one file in the IDE or set run.class
-
-
-
-
-
- Must select some files in the IDE or set test.includes
-
-
-
-
- Must select one file in the IDE or set run.class
-
-
-
-
- Must select one file in the IDE or set applet.url
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must select some files in the IDE or set javac.includes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Some tests failed; see details above.
-
-
-
-
-
-
-
-
- Must select some files in the IDE or set test.includes
-
-
-
- Some tests failed; see details above.
-
-
-
- Must select some files in the IDE or set test.class
- Must select some method in the IDE or set test.method
-
-
-
- Some tests failed; see details above.
-
-
-
-
- Must select one file in the IDE or set test.class
-
-
-
- Must select one file in the IDE or set test.class
- Must select some method in the IDE or set test.method
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must select one file in the IDE or set applet.url
-
-
-
-
-
-
-
-
- Must select one file in the IDE or set applet.url
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/nbproject/copylibstask.jar b/nbproject/copylibstask.jar
index ad1d2ac..45fdbe1 100644
Binary files a/nbproject/copylibstask.jar and b/nbproject/copylibstask.jar differ
diff --git a/nbproject/dist-build.xml b/nbproject/dist-build.xml
new file mode 100644
index 0000000..b980e2d
--- /dev/null
+++ b/nbproject/dist-build.xml
@@ -0,0 +1,34 @@
+
+
+ .
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/nbproject/project.properties b/nbproject/project.properties
deleted file mode 100644
index 8c65b4e..0000000
--- a/nbproject/project.properties
+++ /dev/null
@@ -1,79 +0,0 @@
-annotation.processing.enabled=true
-annotation.processing.enabled.in.editor=false
-annotation.processing.processors.list=
-annotation.processing.run.all.processors=true
-annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
-application.title=ECTester
-application.vendor=xsvenda
-build.classes.dir=${build.dir}/classes
-build.classes.excludes=**/*.java,**/*.form
-# This directory is removed when the project is cleaned:
-build.dir=build
-build.generated.dir=${build.dir}/generated
-build.generated.sources.dir=${build.dir}/generated-sources
-# Only compile against the classpath explicitly listed here:
-build.sysclasspath=ignore
-build.test.classes.dir=${build.dir}/test/classes
-build.test.results.dir=${build.dir}/test/results
-# Uncomment to specify the preferred debugger connection transport:
-#debug.transport=dt_socket
-debug.classpath=\
- ${run.classpath}
-debug.test.classpath=\
- ${run.test.classpath}
-# Files in build.classes.dir which should be excluded from distribution jar
-dist.archive.excludes=
-# This directory is removed when the project is cleaned:
-dist.dir=dist
-dist.jar=${dist.dir}/ECTester.jar
-dist.javadoc.dir=${dist.dir}/javadoc
-libs.CopyLibs.classpath=nbproject/copylibstask.jar
-endorsed.classpath=
-excludes=
-includes=**
-jar.compress=false
-javac.classpath=\
- lib/jcardsim-3.0.4-SNAPSHOT.jar:\
- lib/commons-cli-1.3.1.jar:\
- lib/snakeyaml-1.19.jar
-# Space-separated list of extra javac options
-javac.compilerargs=
-javac.deprecation=false
-javac.processorpath=\
- ${javac.classpath}
-javac.source=1.8
-javac.target=1.8
-javac.test.classpath=\
- ${javac.classpath}:\
- ${build.classes.dir}
-javac.test.processorpath=\
- ${javac.test.classpath}
-javadoc.additionalparam=
-javadoc.author=false
-javadoc.encoding=${source.encoding}
-javadoc.noindex=false
-javadoc.nonavbar=false
-javadoc.notree=false
-javadoc.private=false
-javadoc.splitindex=true
-javadoc.use=true
-javadoc.version=false
-javadoc.windowtitle=
-main.class=cz.crcs.ectester.reader.ECTesterReader
-manifest.file=manifest.mf
-meta.inf.dir=${src.dir}/META-INF
-mkdist.disabled=false
-platform.active=default_platform
-run.classpath=\
- ${javac.classpath}:\
- ${build.classes.dir}
-# Space-separated list of JVM arguments used when running the project.
-# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
-# To set system properties for unit tests define test-sys-prop.name=value:
-run.jvmargs=
-run.test.classpath=\
- ${javac.test.classpath}:\
- ${build.test.classes.dir}
-source.encoding=UTF-8
-src.dir=src
-test.src.dir=test
diff --git a/nbproject/project.xml b/nbproject/project.xml
deleted file mode 100644
index 6e5a48e..0000000
--- a/nbproject/project.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
- org.netbeans.modules.java.j2seproject
-
-
- ECTester
-
-
-
-
-
-
-
-
-
diff --git a/nbproject/reader/build-impl.xml b/nbproject/reader/build-impl.xml
new file mode 100644
index 0000000..f7c43a2
--- /dev/null
+++ b/nbproject/reader/build-impl.xml
@@ -0,0 +1,1413 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set src.dir
+ Must set test.src.dir
+ Must set build.dir
+ Must set dist.dir
+ Must set build.classes.dir
+ Must set dist.javadoc.dir
+ Must set build.test.classes.dir
+ Must set build.test.results.dir
+ Must set build.classes.excludes
+ Must set dist.jar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ No tests executed.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set JVM to use for profiling in profiler.info.jvm
+ Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ To run this application from the command line without Ant, try:
+
+ java -jar "${dist.jar.resolved}"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set debug.class
+
+
+
+
+ Must select one file in the IDE or set debug.class
+
+
+
+
+ Must set fix.includes
+
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set profile.class
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+
+ Must select some files in the IDE or set test.includes
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Some tests failed; see details above.
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set test.includes
+
+
+
+ Some tests failed; see details above.
+
+
+
+ Must select some files in the IDE or set test.class
+ Must select some method in the IDE or set test.method
+
+
+
+ Some tests failed; see details above.
+
+
+
+
+ Must select one file in the IDE or set test.class
+
+
+
+ Must select one file in the IDE or set test.class
+ Must select some method in the IDE or set test.method
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/nbproject/reader/manifest.mf b/nbproject/reader/manifest.mf
new file mode 100644
index 0000000..cbfea93
--- /dev/null
+++ b/nbproject/reader/manifest.mf
@@ -0,0 +1,4 @@
+Manifest-Version: 1.0
+Class-Path: lib/jcardsim-3.0.4-SNAPSHOT.jar lib/commons-cli-1.3.1.jar lib/snakeyaml-1.19.jar
+Main-Class: cz.crcs.ectester.reader.ECTesterReader
+
diff --git a/nbproject/reader/project.properties b/nbproject/reader/project.properties
new file mode 100644
index 0000000..6cd1760
--- /dev/null
+++ b/nbproject/reader/project.properties
@@ -0,0 +1,79 @@
+annotation.processing.enabled=true
+annotation.processing.enabled.in.editor=false
+annotation.processing.processors.list=
+annotation.processing.run.all.processors=true
+annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
+application.title=ECTesterReader
+application.vendor=xsvenda
+build.classes.dir=${build.dir}/classes
+build.classes.excludes=**/*.java,**/*.form
+# This directory is removed when the project is cleaned:
+build.dir=build
+build.generated.dir=${build.dir}/generated
+build.generated.sources.dir=${build.dir}/generated-sources
+# Only compile against the classpath explicitly listed here:
+build.sysclasspath=ignore
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+# Uncomment to specify the preferred debugger connection transport:
+#debug.transport=dt_socket
+debug.classpath=\
+ ${run.classpath}
+debug.test.classpath=\
+ ${run.test.classpath}
+# Files in build.classes.dir which should be excluded from distribution jar
+dist.archive.excludes=
+# This directory is removed when the project is cleaned:
+dist.dir=dist
+dist.jar=${dist.dir}/ECTesterReader.jar
+dist.javadoc.dir=${dist.dir}/javadoc
+libs.CopyLibs.classpath=nbproject/copylibstask.jar
+endorsed.classpath=
+excludes=
+includes=**/applet/**,**/common/**,**/data/**,**/reader/**
+jar.compress=false
+javac.classpath=\
+ lib/jcardsim-3.0.4-SNAPSHOT.jar:\
+ lib/commons-cli-1.3.1.jar:\
+ lib/snakeyaml-1.19.jar
+# Space-separated list of extra javac options
+javac.compilerargs=
+javac.deprecation=false
+javac.processorpath=\
+ ${javac.classpath}
+javac.source=1.8
+javac.target=1.8
+javac.test.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+javac.test.processorpath=\
+ ${javac.test.classpath}
+javadoc.additionalparam=
+javadoc.author=false
+javadoc.encoding=${source.encoding}
+javadoc.noindex=false
+javadoc.nonavbar=false
+javadoc.notree=false
+javadoc.private=false
+javadoc.splitindex=true
+javadoc.use=true
+javadoc.version=false
+javadoc.windowtitle=
+main.class=cz.crcs.ectester.reader.ECTesterReader
+manifest.file=nbproject/reader/manifest.mf
+meta.inf.dir=${src.dir}/META-INF
+mkdist.disabled=false
+platform.active=default_platform
+run.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+# Space-separated list of JVM arguments used when running the project.
+# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
+# To set system properties for unit tests define test-sys-prop.name=value:
+run.jvmargs=
+run.test.classpath=\
+ ${javac.test.classpath}:\
+ ${build.test.classes.dir}
+source.encoding=UTF-8
+src.dir=src
+test.src.dir=test
diff --git a/nbproject/reader/project.xml b/nbproject/reader/project.xml
new file mode 100644
index 0000000..aebe217
--- /dev/null
+++ b/nbproject/reader/project.xml
@@ -0,0 +1,15 @@
+
+
+ org.netbeans.modules.java.j2seproject
+
+
+ ECTesterReader
+
+
+
+
+
+
+
+
+
diff --git a/nbproject/standalone/build-impl.xml b/nbproject/standalone/build-impl.xml
new file mode 100644
index 0000000..a1f91c2
--- /dev/null
+++ b/nbproject/standalone/build-impl.xml
@@ -0,0 +1,1413 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set src.dir
+ Must set test.src.dir
+ Must set build.dir
+ Must set dist.dir
+ Must set build.classes.dir
+ Must set dist.javadoc.dir
+ Must set build.test.classes.dir
+ Must set build.test.results.dir
+ Must set build.classes.excludes
+ Must set dist.jar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ No tests executed.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set JVM to use for profiling in profiler.info.jvm
+ Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ To run this application from the command line without Ant, try:
+
+ java -jar "${dist.jar.resolved}"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set debug.class
+
+
+
+
+ Must select one file in the IDE or set debug.class
+
+
+
+
+ Must set fix.includes
+
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set profile.class
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+
+ Must select some files in the IDE or set test.includes
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Some tests failed; see details above.
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set test.includes
+
+
+
+ Some tests failed; see details above.
+
+
+
+ Must select some files in the IDE or set test.class
+ Must select some method in the IDE or set test.method
+
+
+
+ Some tests failed; see details above.
+
+
+
+
+ Must select one file in the IDE or set test.class
+
+
+
+ Must select one file in the IDE or set test.class
+ Must select some method in the IDE or set test.method
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/nbproject/standalone/manifest.mf b/nbproject/standalone/manifest.mf
new file mode 100644
index 0000000..316e308
--- /dev/null
+++ b/nbproject/standalone/manifest.mf
@@ -0,0 +1,4 @@
+Manifest-Version: 1.0
+Class-Path: lib/jcardsim-3.0.4-SNAPSHOT.jar lib/commons-cli-1.3.1.jar lib/snakeyaml-1.19.jar
+Main-Class: cz.crcs.ectester.standalone.ECTesterStandalone
+
diff --git a/nbproject/standalone/project.properties b/nbproject/standalone/project.properties
new file mode 100644
index 0000000..1952f1d
--- /dev/null
+++ b/nbproject/standalone/project.properties
@@ -0,0 +1,79 @@
+annotation.processing.enabled=true
+annotation.processing.enabled.in.editor=false
+annotation.processing.processors.list=
+annotation.processing.run.all.processors=true
+annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
+application.title=ECTesterStandalone
+application.vendor=xsvenda
+build.classes.dir=${build.dir}/classes
+build.classes.excludes=**/*.java,**/*.form
+# This directory is removed when the project is cleaned:
+build.dir=build
+build.generated.dir=${build.dir}/generated
+build.generated.sources.dir=${build.dir}/generated-sources
+# Only compile against the classpath explicitly listed here:
+build.sysclasspath=ignore
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+# Uncomment to specify the preferred debugger connection transport:
+#debug.transport=dt_socket
+debug.classpath=\
+ ${run.classpath}
+debug.test.classpath=\
+ ${run.test.classpath}
+# Files in build.classes.dir which should be excluded from distribution jar
+dist.archive.excludes=
+# This directory is removed when the project is cleaned:
+dist.dir=dist
+dist.jar=${dist.dir}/ECTesterStandalone.jar
+dist.javadoc.dir=${dist.dir}/javadoc
+libs.CopyLibs.classpath=nbproject/copylibstask.jar
+endorsed.classpath=
+excludes=
+includes=**/common/**,**/standalone/**,**/data/**,**/applet/*
+jar.compress=false
+javac.classpath=\
+ lib/jcardsim-3.0.4-SNAPSHOT.jar:\
+ lib/commons-cli-1.3.1.jar:\
+ lib/snakeyaml-1.19.jar
+# Space-separated list of extra javac options
+javac.compilerargs=
+javac.deprecation=false
+javac.processorpath=\
+ ${javac.classpath}
+javac.source=1.8
+javac.target=1.8
+javac.test.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+javac.test.processorpath=\
+ ${javac.test.classpath}
+javadoc.additionalparam=
+javadoc.author=false
+javadoc.encoding=${source.encoding}
+javadoc.noindex=false
+javadoc.nonavbar=false
+javadoc.notree=false
+javadoc.private=false
+javadoc.splitindex=true
+javadoc.use=true
+javadoc.version=false
+javadoc.windowtitle=
+main.class=cz.crcs.ectester.standalone.ECTesterStandalone
+manifest.file=nbproject/standalone/manifest.mf
+meta.inf.dir=${src.dir}/META-INF
+mkdist.disabled=false
+platform.active=default_platform
+run.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+# Space-separated list of JVM arguments used when running the project.
+# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
+# To set system properties for unit tests define test-sys-prop.name=value:
+run.jvmargs=
+run.test.classpath=\
+ ${javac.test.classpath}:\
+ ${build.test.classes.dir}
+source.encoding=UTF-8
+src.dir=src
+test.src.dir=test
diff --git a/nbproject/standalone/project.xml b/nbproject/standalone/project.xml
new file mode 100644
index 0000000..2f2fb3f
--- /dev/null
+++ b/nbproject/standalone/project.xml
@@ -0,0 +1,15 @@
+
+
+ org.netbeans.modules.java.j2seproject
+
+
+ ECTesterStandalone
+
+
+
+
+
+
+
+
+
diff --git a/src/cz/crcs/ectester/common/Util.java b/src/cz/crcs/ectester/common/Util.java
new file mode 100644
index 0000000..0136493
--- /dev/null
+++ b/src/cz/crcs/ectester/common/Util.java
@@ -0,0 +1,375 @@
+package cz.crcs.ectester.common;
+
+import cz.crcs.ectester.applet.ECTesterApplet;
+import cz.crcs.ectester.applet.EC_Consts;
+import javacard.framework.ISO7816;
+import javacard.security.CryptoException;
+
+import static cz.crcs.ectester.applet.ECTesterApplet.*;
+
+/**
+ * Utility class, some byte/hex manipulation, convenient byte[] methods.
+ *
+ * @author Petr Svenda petr@svenda.com
+ * @author Jan Jancar johny@neuromancer.sk
+ */
+public class Util {
+
+ public static short getShort(byte[] array, int offset) {
+ return (short) (((array[offset] & 0xFF) << 8) | (array[offset + 1] & 0xFF));
+ }
+
+ public static void setShort(byte[] array, int offset, short value) {
+ array[offset + 1] = (byte) (value & 0xFF);
+ array[offset] = (byte) ((value >> 8) & 0xFF);
+ }
+
+ public static int diffBytes(byte[] one, int oneOffset, byte[] other, int otherOffset, int length) {
+ for (int i = 0; i < length; ++i) {
+ byte a = one[i + oneOffset];
+ byte b = other[i + otherOffset];
+ if (a != b) {
+ return i;
+ }
+ }
+ return length;
+ }
+
+ public static boolean compareBytes(byte[] one, int oneOffset, byte[] other, int otherOffset, int length) {
+ return diffBytes(one, oneOffset, other, otherOffset, length) == length;
+ }
+
+ public static boolean allValue(byte[] array, byte value) {
+ for (byte a : array) {
+ if (a != value)
+ return false;
+ }
+ return true;
+ }
+
+ public static byte[] hexToBytes(String hex) {
+ return hexToBytes(hex, true);
+ }
+
+ public static byte[] hexToBytes(String hex, boolean bigEndian) {
+ hex = hex.replace(" ", "");
+ int len = hex.length();
+ StringBuilder sb = new StringBuilder();
+
+ if (len % 2 == 1) {
+ sb.append("0");
+ ++len;
+ }
+
+ if (bigEndian) {
+ sb.append(hex);
+ } else {
+ for (int i = 0; i < len / 2; ++i) {
+ if (sb.length() >= 2) {
+ sb.insert(sb.length() - 2, hex.substring(2 * i, 2 * i + 2));
+ } else {
+ sb.append(hex.substring(2 * i, 2 * i + 2));
+ }
+
+ }
+ }
+
+ String data = sb.toString();
+ byte[] result = new byte[len / 2];
+ for (int i = 0; i < len; i += 2) {
+ result[i / 2] = (byte) ((Character.digit(data.charAt(i), 16) << 4)
+ + (Character.digit(data.charAt(i + 1), 16)));
+ }
+ return result;
+ }
+
+ public static String byteToHex(byte data) {
+ return String.format("%02x", data);
+ }
+
+ public static String bytesToHex(byte[] data) {
+ return bytesToHex(data, true);
+ }
+
+ public static String bytesToHex(byte[] data, boolean addSpace) {
+ return bytesToHex(data, 0, data.length, addSpace);
+ }
+
+ public static String bytesToHex(byte[] data, int offset, int len) {
+ return bytesToHex(data, offset, len, true);
+ }
+
+ public static String bytesToHex(byte[] data, int offset, int len, boolean addSpace) {
+ StringBuilder buf = new StringBuilder();
+ for (int i = offset; i < (offset + len); i++) {
+ buf.append(byteToHex(data[i]));
+ if (addSpace && i != (offset + len - 1)) {
+ buf.append(" ");
+ }
+ }
+ return (buf.toString());
+ }
+
+ public static byte[] concatenate(byte[]... arrays) {
+ int len = 0;
+ for (byte[] array : arrays) {
+ if (array == null)
+ continue;
+ len += array.length;
+ }
+ byte[] out = new byte[len];
+ int offset = 0;
+ for (byte[] array : arrays) {
+ if (array == null || array.length == 0)
+ continue;
+ System.arraycopy(array, 0, out, offset, array.length);
+ offset += array.length;
+ }
+ return out;
+ }
+
+ public static String getSWSource(short sw) {
+ switch (sw) {
+ case ISO7816.SW_NO_ERROR:
+ case ISO7816.SW_APPLET_SELECT_FAILED:
+ case ISO7816.SW_BYTES_REMAINING_00:
+ case ISO7816.SW_CLA_NOT_SUPPORTED:
+ case ISO7816.SW_COMMAND_NOT_ALLOWED:
+ case ISO7816.SW_CONDITIONS_NOT_SATISFIED:
+ case ISO7816.SW_CORRECT_LENGTH_00:
+ case ISO7816.SW_DATA_INVALID:
+ case ISO7816.SW_FILE_FULL:
+ case ISO7816.SW_FILE_INVALID:
+ case ISO7816.SW_FILE_NOT_FOUND:
+ case ISO7816.SW_FUNC_NOT_SUPPORTED:
+ case ISO7816.SW_INCORRECT_P1P2:
+ case ISO7816.SW_INS_NOT_SUPPORTED:
+ case ISO7816.SW_LOGICAL_CHANNEL_NOT_SUPPORTED:
+ case ISO7816.SW_RECORD_NOT_FOUND:
+ case ISO7816.SW_SECURE_MESSAGING_NOT_SUPPORTED:
+ case ISO7816.SW_SECURITY_STATUS_NOT_SATISFIED:
+ case ISO7816.SW_UNKNOWN:
+ case ISO7816.SW_WARNING_STATE_UNCHANGED:
+ case ISO7816.SW_WRONG_DATA:
+ case ISO7816.SW_WRONG_LENGTH:
+ case ISO7816.SW_WRONG_P1P2:
+ return "ISO";
+ case CryptoException.ILLEGAL_VALUE:
+ case CryptoException.UNINITIALIZED_KEY:
+ case CryptoException.NO_SUCH_ALGORITHM:
+ case CryptoException.INVALID_INIT:
+ case CryptoException.ILLEGAL_USE:
+ return "CryptoException";
+ case ECTesterApplet.SW_SIG_VERIFY_FAIL:
+ case ECTesterApplet.SW_DH_DHC_MISMATCH:
+ case ECTesterApplet.SW_KEYPAIR_NULL:
+ case ECTesterApplet.SW_KA_NULL:
+ case ECTesterApplet.SW_SIGNATURE_NULL:
+ case ECTesterApplet.SW_OBJECT_NULL:
+ return "ECTesterApplet";
+ default:
+ return "?";
+ }
+ }
+
+ public static String getSW(short sw) {
+ String str;
+ switch (sw) {
+ case ISO7816.SW_APPLET_SELECT_FAILED:
+ str = "APPLET_SELECT_FAILED";
+ break;
+ case ISO7816.SW_BYTES_REMAINING_00:
+ str = "BYTES_REMAINING";
+ break;
+ case ISO7816.SW_CLA_NOT_SUPPORTED:
+ str = "CLA_NOT_SUPPORTED";
+ break;
+ case ISO7816.SW_COMMAND_NOT_ALLOWED:
+ str = "COMMAND_NOT_ALLOWED";
+ break;
+ case ISO7816.SW_CONDITIONS_NOT_SATISFIED:
+ str = "CONDITIONS_NOT_SATISFIED";
+ break;
+ case ISO7816.SW_CORRECT_LENGTH_00:
+ str = "CORRECT_LENGTH";
+ break;
+ case ISO7816.SW_DATA_INVALID:
+ str = "DATA_INVALID";
+ break;
+ case ISO7816.SW_FILE_FULL:
+ str = "FILE_FULL";
+ break;
+ case ISO7816.SW_FILE_INVALID:
+ str = "FILE_INVALID";
+ break;
+ case ISO7816.SW_FILE_NOT_FOUND:
+ str = "FILE_NOT_FOUND";
+ break;
+ case ISO7816.SW_FUNC_NOT_SUPPORTED:
+ str = "FUNC_NOT_SUPPORTED";
+ break;
+ case ISO7816.SW_INCORRECT_P1P2:
+ str = "INCORRECT_P1P2";
+ break;
+ case ISO7816.SW_INS_NOT_SUPPORTED:
+ str = "INS_NOT_SUPPORTED";
+ break;
+ case ISO7816.SW_LOGICAL_CHANNEL_NOT_SUPPORTED:
+ str = "LOGICAL_CHANNEL_NOT_SUPPORTED";
+ break;
+ case ISO7816.SW_RECORD_NOT_FOUND:
+ str = "RECORD_NOT_FOUND";
+ break;
+ case ISO7816.SW_SECURE_MESSAGING_NOT_SUPPORTED:
+ str = "SECURE_MESSAGING_NOT_SUPPORTED";
+ break;
+ case ISO7816.SW_SECURITY_STATUS_NOT_SATISFIED:
+ str = "SECURITY_STATUS_NOT_SATISFIED";
+ break;
+ case ISO7816.SW_UNKNOWN:
+ str = "UNKNOWN";
+ break;
+ case ISO7816.SW_WARNING_STATE_UNCHANGED:
+ str = "WARNING_STATE_UNCHANGED";
+ break;
+ case ISO7816.SW_WRONG_DATA:
+ str = "WRONG_DATA";
+ break;
+ case ISO7816.SW_WRONG_LENGTH:
+ str = "WRONG_LENGTH";
+ break;
+ case ISO7816.SW_WRONG_P1P2:
+ str = "WRONG_P1P2";
+ break;
+ case CryptoException.ILLEGAL_VALUE:
+ str = "ILLEGAL_VALUE";
+ break;
+ case CryptoException.UNINITIALIZED_KEY:
+ str = "UNINITIALIZED_KEY";
+ break;
+ case CryptoException.NO_SUCH_ALGORITHM:
+ str = "NO_SUCH_ALG";
+ break;
+ case CryptoException.INVALID_INIT:
+ str = "INVALID_INIT";
+ break;
+ case CryptoException.ILLEGAL_USE:
+ str = "ILLEGAL_USE";
+ break;
+ case ECTesterApplet.SW_SIG_VERIFY_FAIL:
+ str = "SIG_VERIFY_FAIL";
+ break;
+ case ECTesterApplet.SW_DH_DHC_MISMATCH:
+ str = "DH_DHC_MISMATCH";
+ break;
+ case ECTesterApplet.SW_KEYPAIR_NULL:
+ str = "KEYPAIR_NULL";
+ break;
+ case ECTesterApplet.SW_KA_NULL:
+ str = "KA_NULL";
+ break;
+ case ECTesterApplet.SW_SIGNATURE_NULL:
+ str = "SIGNATURE_NULL";
+ break;
+ case ECTesterApplet.SW_OBJECT_NULL:
+ str = "OBJECT_NULL";
+ break;
+ default:
+ str = "unknown";
+ break;
+ }
+ return str;
+ }
+
+ public static String getSWString(short sw) {
+ if (sw == ISO7816.SW_NO_ERROR) {
+ return "OK (0x9000)";
+ } else {
+ String str = getSW(sw);
+ return String.format("fail (%s, 0x%04x)", str, sw);
+ }
+ }
+
+ public static String getCorruption(short corruptionType) {
+ String corrupt;
+ switch (corruptionType) {
+ case EC_Consts.CORRUPTION_NONE:
+ corrupt = "NONE";
+ break;
+ case EC_Consts.CORRUPTION_FIXED:
+ corrupt = "FIXED";
+ break;
+ case EC_Consts.CORRUPTION_ONE:
+ corrupt = "ONE";
+ break;
+ case EC_Consts.CORRUPTION_ZERO:
+ corrupt = "ZERO";
+ break;
+ case EC_Consts.CORRUPTION_ONEBYTERANDOM:
+ corrupt = "ONE_BYTE_RANDOM";
+ break;
+ case EC_Consts.CORRUPTION_FULLRANDOM:
+ corrupt = "FULL_RANDOM";
+ break;
+ case EC_Consts.CORRUPTION_INCREMENT:
+ corrupt = "INCREMENT";
+ break;
+ case EC_Consts.CORRUPTION_INFINITY:
+ corrupt = "INFINITY";
+ break;
+ case EC_Consts.CORRUPTION_COMPRESS:
+ corrupt = "COMPRESSED";
+ break;
+ case EC_Consts.CORRUPTION_MAX:
+ corrupt = "MAX";
+ break;
+ default:
+ corrupt = "unknown";
+ break;
+ }
+ return corrupt;
+ }
+
+ public static String getKA(byte ka) {
+ String algo = "";
+ if ((ka & EC_Consts.KA_ECDH) != 0 || ka == EC_Consts.KA_ANY) {
+ algo += "ECDH";
+ }
+ if (ka == EC_Consts.KA_BOTH) {
+ algo += "+";
+ } else if (ka == EC_Consts.KA_ANY) {
+ algo += "/";
+ }
+ if ((ka & EC_Consts.KA_ECDHC) != 0 || ka == EC_Consts.KA_ANY) {
+ algo += "ECDHC";
+ }
+ return algo;
+ }
+
+ public static String getKATypeString(byte kaType) {
+ String kaTypeString;
+ switch (kaType) {
+ case KeyAgreement_ALG_EC_SVDP_DH:
+ kaTypeString = "ALG_EC_SVDP_DH";
+ break;
+ case KeyAgreement_ALG_EC_SVDP_DH_PLAIN:
+ kaTypeString = "ALG_EC_SVDP_DH_PLAIN";
+ break;
+ case KeyAgreement_ALG_EC_PACE_GM:
+ kaTypeString = "ALG_EC_PACE_GM";
+ break;
+ case KeyAgreement_ALG_EC_SVDP_DH_PLAIN_XY:
+ kaTypeString = "ALG_EC_SVDP_DH_PLAIN_XY";
+ break;
+ case KeyAgreement_ALG_EC_SVDP_DHC:
+ kaTypeString = "ALG_EC_SVDP_DHC";
+ break;
+ case KeyAgreement_ALG_EC_SVDP_DHC_PLAIN:
+ kaTypeString = "ALG_EC_SVDP_DHC_PLAIN";
+ break;
+ default:
+ kaTypeString = "unknown";
+ }
+ return kaTypeString;
+ }
+}
diff --git a/src/cz/crcs/ectester/common/ec/EC_Data.java b/src/cz/crcs/ectester/common/ec/EC_Data.java
index da97208..d308261 100644
--- a/src/cz/crcs/ectester/common/ec/EC_Data.java
+++ b/src/cz/crcs/ectester/common/ec/EC_Data.java
@@ -1,6 +1,6 @@
package cz.crcs.ectester.common.ec;
-import cz.crcs.ectester.reader.Util;
+import cz.crcs.ectester.common.Util;
import java.io.*;
import java.util.*;
diff --git a/src/cz/crcs/ectester/common/ec/EC_KAResult.java b/src/cz/crcs/ectester/common/ec/EC_KAResult.java
index b215d0e..3b74c57 100644
--- a/src/cz/crcs/ectester/common/ec/EC_KAResult.java
+++ b/src/cz/crcs/ectester/common/ec/EC_KAResult.java
@@ -1,6 +1,6 @@
package cz.crcs.ectester.common.ec;
-import cz.crcs.ectester.reader.Util;
+import cz.crcs.ectester.common.Util;
/**
* A result of EC based Key agreement operation.
diff --git a/src/cz/crcs/ectester/common/ec/EC_Params.java b/src/cz/crcs/ectester/common/ec/EC_Params.java
index 5b8295e..d50ebb0 100644
--- a/src/cz/crcs/ectester/common/ec/EC_Params.java
+++ b/src/cz/crcs/ectester/common/ec/EC_Params.java
@@ -1,7 +1,7 @@
package cz.crcs.ectester.common.ec;
import cz.crcs.ectester.applet.EC_Consts;
-import cz.crcs.ectester.reader.Util;
+import cz.crcs.ectester.common.Util;
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
diff --git a/src/cz/crcs/ectester/common/output/OutputLogger.java b/src/cz/crcs/ectester/common/output/OutputLogger.java
index b876c5b..09b8f73 100644
--- a/src/cz/crcs/ectester/common/output/OutputLogger.java
+++ b/src/cz/crcs/ectester/common/output/OutputLogger.java
@@ -1,7 +1,5 @@
package cz.crcs.ectester.common.output;
-import cz.crcs.ectester.reader.output.TeeOutputStream;
-
import java.io.*;
import java.util.LinkedList;
import java.util.List;
diff --git a/src/cz/crcs/ectester/common/output/TeeOutputStream.java b/src/cz/crcs/ectester/common/output/TeeOutputStream.java
new file mode 100644
index 0000000..2401fce
--- /dev/null
+++ b/src/cz/crcs/ectester/common/output/TeeOutputStream.java
@@ -0,0 +1,36 @@
+package cz.crcs.ectester.common.output;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * @author Jan Jancar johny@neuromancer.sk
+ */
+public class TeeOutputStream extends OutputStream {
+ private OutputStream[] outputs;
+
+ public TeeOutputStream(OutputStream... outputs) {
+ this.outputs = outputs;
+ }
+
+ @Override
+ public void write(int b) throws IOException {
+ for (OutputStream out : outputs) {
+ out.write(b);
+ }
+ }
+
+ @Override
+ public void flush() throws IOException {
+ for (OutputStream out : outputs) {
+ out.flush();
+ }
+ }
+
+ @Override
+ public void close() throws IOException {
+ for (OutputStream out : outputs) {
+ out.close();
+ }
+ }
+}
diff --git a/src/cz/crcs/ectester/common/test/Test.java b/src/cz/crcs/ectester/common/test/Test.java
index 5973d0f..750a410 100644
--- a/src/cz/crcs/ectester/common/test/Test.java
+++ b/src/cz/crcs/ectester/common/test/Test.java
@@ -39,6 +39,13 @@ public abstract class Test implements Testable {
return result.ok();
}
+ public boolean error() {
+ if (!hasRun) {
+ return false;
+ }
+ return result.compareTo(Value.ERROR);
+ }
+
public abstract String getDescription();
public boolean hasRun() {
diff --git a/src/cz/crcs/ectester/reader/CardMngr.java b/src/cz/crcs/ectester/reader/CardMngr.java
index e11bcb3..ad5b368 100644
--- a/src/cz/crcs/ectester/reader/CardMngr.java
+++ b/src/cz/crcs/ectester/reader/CardMngr.java
@@ -2,6 +2,7 @@ package cz.crcs.ectester.reader;
import com.licel.jcardsim.io.CAD;
import com.licel.jcardsim.io.JavaxSmartCardInterface;
+import cz.crcs.ectester.common.Util;
import javacard.framework.AID;
import javax.smartcardio.*;
diff --git a/src/cz/crcs/ectester/reader/ECTesterReader.java b/src/cz/crcs/ectester/reader/ECTesterReader.java
index 99b2f83..e13a683 100644
--- a/src/cz/crcs/ectester/reader/ECTesterReader.java
+++ b/src/cz/crcs/ectester/reader/ECTesterReader.java
@@ -23,6 +23,7 @@ package cz.crcs.ectester.reader;
import cz.crcs.ectester.applet.ECTesterApplet;
import cz.crcs.ectester.applet.EC_Consts;
+import cz.crcs.ectester.common.Util;
import cz.crcs.ectester.common.ec.EC_Category;
import cz.crcs.ectester.common.ec.EC_Data;
import cz.crcs.ectester.common.ec.EC_Params;
diff --git a/src/cz/crcs/ectester/reader/Util.java b/src/cz/crcs/ectester/reader/Util.java
deleted file mode 100644
index 001f58c..0000000
--- a/src/cz/crcs/ectester/reader/Util.java
+++ /dev/null
@@ -1,375 +0,0 @@
-package cz.crcs.ectester.reader;
-
-import cz.crcs.ectester.applet.ECTesterApplet;
-import cz.crcs.ectester.applet.EC_Consts;
-import javacard.framework.ISO7816;
-import javacard.security.CryptoException;
-
-import static cz.crcs.ectester.applet.ECTesterApplet.*;
-
-/**
- * Utility class, some byte/hex manipulation, convenient byte[] methods.
- *
- * @author Petr Svenda petr@svenda.com
- * @author Jan Jancar johny@neuromancer.sk
- */
-public class Util {
-
- public static short getShort(byte[] array, int offset) {
- return (short) (((array[offset] & 0xFF) << 8) | (array[offset + 1] & 0xFF));
- }
-
- public static void setShort(byte[] array, int offset, short value) {
- array[offset + 1] = (byte) (value & 0xFF);
- array[offset] = (byte) ((value >> 8) & 0xFF);
- }
-
- public static int diffBytes(byte[] one, int oneOffset, byte[] other, int otherOffset, int length) {
- for (int i = 0; i < length; ++i) {
- byte a = one[i + oneOffset];
- byte b = other[i + otherOffset];
- if (a != b) {
- return i;
- }
- }
- return length;
- }
-
- public static boolean compareBytes(byte[] one, int oneOffset, byte[] other, int otherOffset, int length) {
- return diffBytes(one, oneOffset, other, otherOffset, length) == length;
- }
-
- public static boolean allValue(byte[] array, byte value) {
- for (byte a : array) {
- if (a != value)
- return false;
- }
- return true;
- }
-
- public static byte[] hexToBytes(String hex) {
- return hexToBytes(hex, true);
- }
-
- public static byte[] hexToBytes(String hex, boolean bigEndian) {
- hex = hex.replace(" ", "");
- int len = hex.length();
- StringBuilder sb = new StringBuilder();
-
- if (len % 2 == 1) {
- sb.append("0");
- ++len;
- }
-
- if (bigEndian) {
- sb.append(hex);
- } else {
- for (int i = 0; i < len / 2; ++i) {
- if (sb.length() >= 2) {
- sb.insert(sb.length() - 2, hex.substring(2 * i, 2 * i + 2));
- } else {
- sb.append(hex.substring(2 * i, 2 * i + 2));
- }
-
- }
- }
-
- String data = sb.toString();
- byte[] result = new byte[len / 2];
- for (int i = 0; i < len; i += 2) {
- result[i / 2] = (byte) ((Character.digit(data.charAt(i), 16) << 4)
- + (Character.digit(data.charAt(i + 1), 16)));
- }
- return result;
- }
-
- public static String byteToHex(byte data) {
- return String.format("%02x", data);
- }
-
- public static String bytesToHex(byte[] data) {
- return bytesToHex(data, true);
- }
-
- public static String bytesToHex(byte[] data, boolean addSpace) {
- return bytesToHex(data, 0, data.length, addSpace);
- }
-
- public static String bytesToHex(byte[] data, int offset, int len) {
- return bytesToHex(data, offset, len, true);
- }
-
- public static String bytesToHex(byte[] data, int offset, int len, boolean addSpace) {
- StringBuilder buf = new StringBuilder();
- for (int i = offset; i < (offset + len); i++) {
- buf.append(byteToHex(data[i]));
- if (addSpace && i != (offset + len - 1)) {
- buf.append(" ");
- }
- }
- return (buf.toString());
- }
-
- public static byte[] concatenate(byte[]... arrays) {
- int len = 0;
- for (byte[] array : arrays) {
- if (array == null)
- continue;
- len += array.length;
- }
- byte[] out = new byte[len];
- int offset = 0;
- for (byte[] array : arrays) {
- if (array == null || array.length == 0)
- continue;
- System.arraycopy(array, 0, out, offset, array.length);
- offset += array.length;
- }
- return out;
- }
-
- public static String getSWSource(short sw) {
- switch (sw) {
- case ISO7816.SW_NO_ERROR:
- case ISO7816.SW_APPLET_SELECT_FAILED:
- case ISO7816.SW_BYTES_REMAINING_00:
- case ISO7816.SW_CLA_NOT_SUPPORTED:
- case ISO7816.SW_COMMAND_NOT_ALLOWED:
- case ISO7816.SW_CONDITIONS_NOT_SATISFIED:
- case ISO7816.SW_CORRECT_LENGTH_00:
- case ISO7816.SW_DATA_INVALID:
- case ISO7816.SW_FILE_FULL:
- case ISO7816.SW_FILE_INVALID:
- case ISO7816.SW_FILE_NOT_FOUND:
- case ISO7816.SW_FUNC_NOT_SUPPORTED:
- case ISO7816.SW_INCORRECT_P1P2:
- case ISO7816.SW_INS_NOT_SUPPORTED:
- case ISO7816.SW_LOGICAL_CHANNEL_NOT_SUPPORTED:
- case ISO7816.SW_RECORD_NOT_FOUND:
- case ISO7816.SW_SECURE_MESSAGING_NOT_SUPPORTED:
- case ISO7816.SW_SECURITY_STATUS_NOT_SATISFIED:
- case ISO7816.SW_UNKNOWN:
- case ISO7816.SW_WARNING_STATE_UNCHANGED:
- case ISO7816.SW_WRONG_DATA:
- case ISO7816.SW_WRONG_LENGTH:
- case ISO7816.SW_WRONG_P1P2:
- return "ISO";
- case CryptoException.ILLEGAL_VALUE:
- case CryptoException.UNINITIALIZED_KEY:
- case CryptoException.NO_SUCH_ALGORITHM:
- case CryptoException.INVALID_INIT:
- case CryptoException.ILLEGAL_USE:
- return "CryptoException";
- case ECTesterApplet.SW_SIG_VERIFY_FAIL:
- case ECTesterApplet.SW_DH_DHC_MISMATCH:
- case ECTesterApplet.SW_KEYPAIR_NULL:
- case ECTesterApplet.SW_KA_NULL:
- case ECTesterApplet.SW_SIGNATURE_NULL:
- case ECTesterApplet.SW_OBJECT_NULL:
- return "ECTesterApplet";
- default:
- return "?";
- }
- }
-
- public static String getSW(short sw) {
- String str;
- switch (sw) {
- case ISO7816.SW_APPLET_SELECT_FAILED:
- str = "APPLET_SELECT_FAILED";
- break;
- case ISO7816.SW_BYTES_REMAINING_00:
- str = "BYTES_REMAINING";
- break;
- case ISO7816.SW_CLA_NOT_SUPPORTED:
- str = "CLA_NOT_SUPPORTED";
- break;
- case ISO7816.SW_COMMAND_NOT_ALLOWED:
- str = "COMMAND_NOT_ALLOWED";
- break;
- case ISO7816.SW_CONDITIONS_NOT_SATISFIED:
- str = "CONDITIONS_NOT_SATISFIED";
- break;
- case ISO7816.SW_CORRECT_LENGTH_00:
- str = "CORRECT_LENGTH";
- break;
- case ISO7816.SW_DATA_INVALID:
- str = "DATA_INVALID";
- break;
- case ISO7816.SW_FILE_FULL:
- str = "FILE_FULL";
- break;
- case ISO7816.SW_FILE_INVALID:
- str = "FILE_INVALID";
- break;
- case ISO7816.SW_FILE_NOT_FOUND:
- str = "FILE_NOT_FOUND";
- break;
- case ISO7816.SW_FUNC_NOT_SUPPORTED:
- str = "FUNC_NOT_SUPPORTED";
- break;
- case ISO7816.SW_INCORRECT_P1P2:
- str = "INCORRECT_P1P2";
- break;
- case ISO7816.SW_INS_NOT_SUPPORTED:
- str = "INS_NOT_SUPPORTED";
- break;
- case ISO7816.SW_LOGICAL_CHANNEL_NOT_SUPPORTED:
- str = "LOGICAL_CHANNEL_NOT_SUPPORTED";
- break;
- case ISO7816.SW_RECORD_NOT_FOUND:
- str = "RECORD_NOT_FOUND";
- break;
- case ISO7816.SW_SECURE_MESSAGING_NOT_SUPPORTED:
- str = "SECURE_MESSAGING_NOT_SUPPORTED";
- break;
- case ISO7816.SW_SECURITY_STATUS_NOT_SATISFIED:
- str = "SECURITY_STATUS_NOT_SATISFIED";
- break;
- case ISO7816.SW_UNKNOWN:
- str = "UNKNOWN";
- break;
- case ISO7816.SW_WARNING_STATE_UNCHANGED:
- str = "WARNING_STATE_UNCHANGED";
- break;
- case ISO7816.SW_WRONG_DATA:
- str = "WRONG_DATA";
- break;
- case ISO7816.SW_WRONG_LENGTH:
- str = "WRONG_LENGTH";
- break;
- case ISO7816.SW_WRONG_P1P2:
- str = "WRONG_P1P2";
- break;
- case CryptoException.ILLEGAL_VALUE:
- str = "ILLEGAL_VALUE";
- break;
- case CryptoException.UNINITIALIZED_KEY:
- str = "UNINITIALIZED_KEY";
- break;
- case CryptoException.NO_SUCH_ALGORITHM:
- str = "NO_SUCH_ALG";
- break;
- case CryptoException.INVALID_INIT:
- str = "INVALID_INIT";
- break;
- case CryptoException.ILLEGAL_USE:
- str = "ILLEGAL_USE";
- break;
- case ECTesterApplet.SW_SIG_VERIFY_FAIL:
- str = "SIG_VERIFY_FAIL";
- break;
- case ECTesterApplet.SW_DH_DHC_MISMATCH:
- str = "DH_DHC_MISMATCH";
- break;
- case ECTesterApplet.SW_KEYPAIR_NULL:
- str = "KEYPAIR_NULL";
- break;
- case ECTesterApplet.SW_KA_NULL:
- str = "KA_NULL";
- break;
- case ECTesterApplet.SW_SIGNATURE_NULL:
- str = "SIGNATURE_NULL";
- break;
- case ECTesterApplet.SW_OBJECT_NULL:
- str = "OBJECT_NULL";
- break;
- default:
- str = "unknown";
- break;
- }
- return str;
- }
-
- public static String getSWString(short sw) {
- if (sw == ISO7816.SW_NO_ERROR) {
- return "OK (0x9000)";
- } else {
- String str = getSW(sw);
- return String.format("fail (%s, 0x%04x)", str, sw);
- }
- }
-
- public static String getCorruption(short corruptionType) {
- String corrupt;
- switch (corruptionType) {
- case EC_Consts.CORRUPTION_NONE:
- corrupt = "NONE";
- break;
- case EC_Consts.CORRUPTION_FIXED:
- corrupt = "FIXED";
- break;
- case EC_Consts.CORRUPTION_ONE:
- corrupt = "ONE";
- break;
- case EC_Consts.CORRUPTION_ZERO:
- corrupt = "ZERO";
- break;
- case EC_Consts.CORRUPTION_ONEBYTERANDOM:
- corrupt = "ONE_BYTE_RANDOM";
- break;
- case EC_Consts.CORRUPTION_FULLRANDOM:
- corrupt = "FULL_RANDOM";
- break;
- case EC_Consts.CORRUPTION_INCREMENT:
- corrupt = "INCREMENT";
- break;
- case EC_Consts.CORRUPTION_INFINITY:
- corrupt = "INFINITY";
- break;
- case EC_Consts.CORRUPTION_COMPRESS:
- corrupt = "COMPRESSED";
- break;
- case EC_Consts.CORRUPTION_MAX:
- corrupt = "MAX";
- break;
- default:
- corrupt = "unknown";
- break;
- }
- return corrupt;
- }
-
- public static String getKA(byte ka) {
- String algo = "";
- if ((ka & EC_Consts.KA_ECDH) != 0 || ka == EC_Consts.KA_ANY) {
- algo += "ECDH";
- }
- if (ka == EC_Consts.KA_BOTH) {
- algo += "+";
- } else if (ka == EC_Consts.KA_ANY) {
- algo += "/";
- }
- if ((ka & EC_Consts.KA_ECDHC) != 0 || ka == EC_Consts.KA_ANY) {
- algo += "ECDHC";
- }
- return algo;
- }
-
- public static String getKATypeString(byte kaType) {
- String kaTypeString;
- switch (kaType) {
- case KeyAgreement_ALG_EC_SVDP_DH:
- kaTypeString = "ALG_EC_SVDP_DH";
- break;
- case KeyAgreement_ALG_EC_SVDP_DH_PLAIN:
- kaTypeString = "ALG_EC_SVDP_DH_PLAIN";
- break;
- case KeyAgreement_ALG_EC_PACE_GM:
- kaTypeString = "ALG_EC_PACE_GM";
- break;
- case KeyAgreement_ALG_EC_SVDP_DH_PLAIN_XY:
- kaTypeString = "ALG_EC_SVDP_DH_PLAIN_XY";
- break;
- case KeyAgreement_ALG_EC_SVDP_DHC:
- kaTypeString = "ALG_EC_SVDP_DHC";
- break;
- case KeyAgreement_ALG_EC_SVDP_DHC_PLAIN:
- kaTypeString = "ALG_EC_SVDP_DHC_PLAIN";
- break;
- default:
- kaTypeString = "unknown";
- }
- return kaTypeString;
- }
-}
diff --git a/src/cz/crcs/ectester/reader/command/Command.java b/src/cz/crcs/ectester/reader/command/Command.java
index 3668fbb..9d23322 100644
--- a/src/cz/crcs/ectester/reader/command/Command.java
+++ b/src/cz/crcs/ectester/reader/command/Command.java
@@ -6,7 +6,7 @@ import cz.crcs.ectester.data.EC_Store;
import cz.crcs.ectester.reader.CardMngr;
import cz.crcs.ectester.reader.ECTesterReader;
import cz.crcs.ectester.reader.response.Response;
-import cz.crcs.ectester.reader.Util;
+import cz.crcs.ectester.common.Util;
import cz.crcs.ectester.common.ec.EC_Curve;
import cz.crcs.ectester.common.ec.EC_Key;
import cz.crcs.ectester.common.ec.EC_Keypair;
diff --git a/src/cz/crcs/ectester/reader/output/ResponseWriter.java b/src/cz/crcs/ectester/reader/output/ResponseWriter.java
index c357233..0f5b6e8 100644
--- a/src/cz/crcs/ectester/reader/output/ResponseWriter.java
+++ b/src/cz/crcs/ectester/reader/output/ResponseWriter.java
@@ -1,6 +1,6 @@
package cz.crcs.ectester.reader.output;
-import cz.crcs.ectester.reader.Util;
+import cz.crcs.ectester.common.Util;
import cz.crcs.ectester.reader.response.Response;
import java.io.PrintStream;
diff --git a/src/cz/crcs/ectester/reader/output/TeeOutputStream.java b/src/cz/crcs/ectester/reader/output/TeeOutputStream.java
deleted file mode 100644
index 2a1af99..0000000
--- a/src/cz/crcs/ectester/reader/output/TeeOutputStream.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package cz.crcs.ectester.reader.output;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-/**
- * @author Jan Jancar johny@neuromancer.sk
- */
-public class TeeOutputStream extends OutputStream {
- private OutputStream[] outputs;
-
- public TeeOutputStream(OutputStream... outputs) {
- this.outputs = outputs;
- }
-
- @Override
- public void write(int b) throws IOException {
- for (OutputStream out : outputs) {
- out.write(b);
- }
- }
-
- @Override
- public void flush() throws IOException {
- for (OutputStream out : outputs) {
- out.flush();
- }
- }
-
- @Override
- public void close() throws IOException {
- for (OutputStream out : outputs) {
- out.close();
- }
- }
-}
diff --git a/src/cz/crcs/ectester/reader/output/XMLTestWriter.java b/src/cz/crcs/ectester/reader/output/XMLTestWriter.java
index f35e467..24a308c 100644
--- a/src/cz/crcs/ectester/reader/output/XMLTestWriter.java
+++ b/src/cz/crcs/ectester/reader/output/XMLTestWriter.java
@@ -1,7 +1,7 @@
package cz.crcs.ectester.reader.output;
import cz.crcs.ectester.common.test.CompoundTest;
-import cz.crcs.ectester.reader.Util;
+import cz.crcs.ectester.common.Util;
import cz.crcs.ectester.reader.command.Command;
import cz.crcs.ectester.reader.response.Response;
import cz.crcs.ectester.common.test.Test;
diff --git a/src/cz/crcs/ectester/reader/output/YAMLTestWriter.java b/src/cz/crcs/ectester/reader/output/YAMLTestWriter.java
index 15c0522..c637a13 100644
--- a/src/cz/crcs/ectester/reader/output/YAMLTestWriter.java
+++ b/src/cz/crcs/ectester/reader/output/YAMLTestWriter.java
@@ -1,7 +1,7 @@
package cz.crcs.ectester.reader.output;
import cz.crcs.ectester.common.test.CompoundTest;
-import cz.crcs.ectester.reader.Util;
+import cz.crcs.ectester.common.Util;
import cz.crcs.ectester.reader.command.Command;
import cz.crcs.ectester.reader.response.Response;
import cz.crcs.ectester.common.test.Test;
diff --git a/src/cz/crcs/ectester/reader/response/Response.java b/src/cz/crcs/ectester/reader/response/Response.java
index b816a97..4158ac3 100644
--- a/src/cz/crcs/ectester/reader/response/Response.java
+++ b/src/cz/crcs/ectester/reader/response/Response.java
@@ -2,7 +2,7 @@ package cz.crcs.ectester.reader.response;
import cz.crcs.ectester.applet.ECTesterApplet;
import cz.crcs.ectester.applet.EC_Consts;
-import cz.crcs.ectester.reader.Util;
+import cz.crcs.ectester.common.Util;
import javacard.framework.ISO7816;
import javacard.security.KeyPair;
diff --git a/src/cz/crcs/ectester/reader/test/TestVectorSuite.java b/src/cz/crcs/ectester/reader/test/TestVectorSuite.java
index 742661d..668056b 100644
--- a/src/cz/crcs/ectester/reader/test/TestVectorSuite.java
+++ b/src/cz/crcs/ectester/reader/test/TestVectorSuite.java
@@ -8,7 +8,7 @@ import cz.crcs.ectester.common.test.Test;
import cz.crcs.ectester.data.EC_Store;
import cz.crcs.ectester.reader.CardMngr;
import cz.crcs.ectester.reader.ECTesterReader;
-import cz.crcs.ectester.reader.Util;
+import cz.crcs.ectester.common.Util;
import cz.crcs.ectester.reader.command.Command;
import cz.crcs.ectester.common.ec.*;
import cz.crcs.ectester.reader.response.Response;
diff --git a/src/cz/crcs/ectester/scripts/ectester-reader.bat b/src/cz/crcs/ectester/scripts/ectester-reader.bat
new file mode 100644
index 0000000..876fda7
--- /dev/null
+++ b/src/cz/crcs/ectester/scripts/ectester-reader.bat
@@ -0,0 +1,34 @@
+@ECHO OFF
+SETLOCAL enabledelayedexpansion
+
+SET n=0
+:loop
+IF NOT "%1"=="" (
+ IF "%1"=="--dangerous" (
+ SET dangerous=1
+ ) ELSE (
+ SET positional[!n!]=%1
+ SET /A n+=1
+ )
+ SHIFT
+ GOTO :loop
+)
+
+IF NOT "%n%"=="1" (
+ ECHO "One argument expected:"
+ ECHO " ./ectester-reader.bat [--dangerous] CARD_NAME"
+)
+
+SET card=!positional[%%0]!
+
+SET tests="default test-vectors"
+java -jar ECTesterReader.jar -t default -a --format yaml -l %card%.default
+java -jar ECTesterReader.jar -t test-vectors -a --format yaml -l %card%.test-vectors
+IF "%dangerous%"=="1" (
+ SET tests=%tests% "invalid wrong composite"
+ java -jar ECTesterReader.jar -t invalid -a --format yaml -l %card%.invalid
+ java -jar ECTesterReader.jar -t wrong -a --format yaml -l %card%.wrong
+ java -jar ECTesterReader.jar -t composite -a --format yaml -l %card%.composite
+)
+
+zip %card%.zip %tests%
diff --git a/src/cz/crcs/ectester/scripts/ectester-reader.sh b/src/cz/crcs/ectester/scripts/ectester-reader.sh
new file mode 100755
index 0000000..e6458c9
--- /dev/null
+++ b/src/cz/crcs/ectester/scripts/ectester-reader.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+dangerous="0"
+
+positional=()
+while [[ $# -gt 0 ]]
+do
+
+key="$1"
+case $key in
+ --dangerous)
+ dangerous=1
+ shift
+ ;;
+ *)
+ positional+=("$1")
+ shift
+ ;;
+esac
+done
+set -- "${positional[@]}"
+
+if [[ $# -lt 1 ]]; then
+ echo "At least one argument expected:" >&2
+ echo " ./ectester-reader.sh [--dangerous] CARD_NAME [ECTester args]" >&2
+ exit 1
+fi
+
+card="$1"
+shift
+
+declare -a tests=("default" "test-vectors")
+if [[ "$dangerous" == "1" ]]; then
+ tests+=("invalid" "wrong" "composite")
+fi
+
+declare -a files=()
+for i in $(seq 0 $((${#tests[@]} - 1))); do
+ test="${tests[$i]}"
+ java -jar ECTester.jar -t ${test} -a --format yaml -l ${card}.${test} $@
+ files+=(${card}.$test)
+done
+
+if command -v tar 2>&1 >/dev/null; then
+ tar -czvf ${card}.tar.gz ${files[*]}
+elif command -v zip 2>&1 >/dev/null; then
+ zip ${card}.zip ${files[*]}
+fi
diff --git a/src/cz/crcs/ectester/scripts/ectester.bat b/src/cz/crcs/ectester/scripts/ectester.bat
deleted file mode 100644
index e20b855..0000000
--- a/src/cz/crcs/ectester/scripts/ectester.bat
+++ /dev/null
@@ -1,34 +0,0 @@
-@ECHO OFF
-SETLOCAL enabledelayedexpansion
-
-SET n=0
-:loop
-IF NOT "%1"=="" (
- IF "%1"=="--dangerous" (
- SET dangerous=1
- ) ELSE (
- SET positional[!n!]=%1
- SET /A n+=1
- )
- SHIFT
- GOTO :loop
-)
-
-IF NOT "%n%"=="1" (
- ECHO "One argument expected:"
- ECHO " ./ectester.bar [--dangerous] CARD_NAME"
-)
-
-SET card=!positional[%%0]!
-
-SET tests="default test-vectors"
-java -jar ECTester.jar -t default -a --format yaml -l %card%.default
-java -jar ECTester.jar -t test-vectors -a --format yaml -l %card%.test-vectors
-IF "%dangerous%"=="1" (
- SET tests=%tests% "invalid wrong composite"
- java -jar ECTester.jar -t invalid -a --format yaml -l %card%.invalid
- java -jar ECTester.jar -t wrong -a --format yaml -l %card%.wrong
- java -jar ECTester.jar -t composite -a --format yaml -l %card%.composite
-)
-
-zip %card%.zip %tests%
diff --git a/src/cz/crcs/ectester/scripts/ectester.sh b/src/cz/crcs/ectester/scripts/ectester.sh
deleted file mode 100755
index 8040096..0000000
--- a/src/cz/crcs/ectester/scripts/ectester.sh
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/bash
-
-dangerous="0"
-
-positional=()
-while [[ $# -gt 0 ]]
-do
-
-key="$1"
-case $key in
- --dangerous)
- dangerous=1
- shift
- ;;
- *)
- positional+=("$1")
- shift
- ;;
-esac
-done
-set -- "${positional[@]}"
-
-if [[ $# -lt 1 ]]; then
- echo "At least one argument expected:" >&2
- echo " ./ectester.sh [--dangerous] CARD_NAME [ECTester args]" >&2
- exit 1
-fi
-
-card="$1"
-shift
-
-declare -a tests=("default" "test-vectors")
-if [[ "$dangerous" == "1" ]]; then
- tests+=("invalid" "wrong" "composite")
-fi
-
-declare -a files=()
-for i in $(seq 0 $((${#tests[@]} - 1))); do
- test="${tests[$i]}"
- java -jar ECTester.jar -t ${test} -a --format yaml -l ${card}.${test} $@
- files+=(${card}.$test)
-done
-
-if command -v tar 2>&1 >/dev/null; then
- tar -czvf ${card}.tar.gz ${files[*]}
-elif command -v zip 2>&1 >/dev/null; then
- zip ${card}.zip ${files[*]}
-fi
--
cgit v1.2.3-70-g09d2