|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectds.ov2.test.Test_host
public class Test_host
Main class of the host driver for the test applet that gives access
to all the
functionality of the test applet. This host driver automatically
(re-)installs the applet if it is not found or not up-to-date. The
driver can talk to real cards or to the jcop emulator,
see the options -c
and -r
.
(It can also talk to the SUN emulators cref and jcwde, however,
applet installation fails there because of the absense of the RSA
cipher.)
The test host driver is a non-interactive terminal program that can run several tests and performance measurements. What test and measurments are run depends on the command line options. As default nothing is run. The measurements results are printed in gnuplot compatible way. For examples on how to produce nice charts out of the performance data, see the gnuplot scripts in the subdirectory test/Measurments.
Some parts of the command line that is necessary to start this program depend on the configuration. Therefore the makefile generates the test_host shell script for a convenient invocation.
There are two different kinds of command line options for this
program: The task selection options that enable one of the checks
or measurements and the configuration options that change some more
or less common behavior (for instance to talk to a card or an
emulator). The complete list of options is printed for the options
-h
, -help
and --help
.
-data-perf
all measurements do also check the results of the card and do
immediately stop the program on any error encountered.
The checks perform their computations with numbers of the long
(base) size, which can be set with -size
. Except for -data-perf
all performance measurements measure the time for
different sizes. That is, the measurements run in a loop with
increasing sizes. Except -data-perf
all measurements
recognize the -start-size
option to set the starting size.
The possible tests and measurements and the corresponding task selection options are as follows:
-size
that size is used for all check. Otherwise the size
is adjusted so that the check do not take too long.
Security_parameter
) if no exponent size
has been set before. All checks perform their computaitions with
the long bignat size. Many tests and measurements need to take care
of Montgomery
digits. This means that the numbers that are used in these
computations are two digits (i.e., two bytes for the byte/short
configuration of the bignat library) shorter than what specified
with this option.
-div-length 50
-i
, except that n is a hexadicimal number
string, which can contain dots to separate digit groups.
-list-reader
.
State.verbosity
for
explanations about these levels.
Static class.
Field Summary | |
---|---|
private static int |
all_checks_rounds
Number of rounds to run all checks for the -all-checks option. |
private static Reference<Integer> |
card_reader_number
The index of the card reader to connect to. |
private static SimpleDateFormat |
date_format
Date formatter used here at various places. |
private static Reference<Integer> |
jcop_port_number
The port number used for the jcop emulator. |
private static Reference<Boolean> |
keep_applet
Controls applet reinstallation. |
static String |
long_application_name
Long application name. |
static Option[] |
options
Array declaring all recognized command line options. |
private static Reference<Boolean> |
reinstall_applet
Controls applet (re-)installation. |
private static Reference<Boolean> |
run_add_perf
Controls addition performance. |
private static Reference<Boolean> |
run_all_checks
Controls running all checks. |
private static Reference<Boolean> |
run_data_check
Controls the data transfer check. |
private static Reference<Boolean> |
run_data_perf
Controls the data transfer measurement. |
private static Reference<Boolean> |
run_div_check
Controls the division check. |
private static Reference<Boolean> |
run_div_perf
Controls the division performance. |
private static Reference<Boolean> |
run_list_applets
Controls applet listing. |
private static Reference<Boolean> |
run_list_readers
Controls whether to list all connected readers. |
private static Reference<Boolean> |
run_mem_size
Crontrols whether to query the memory size. |
private static Reference<Boolean> |
run_mont_mult_check
Controls the Montgomery multiplication check. |
private static Reference<Boolean> |
run_mont_mult_perf
Controls the Montgomery multiplication measurement. |
private static Reference<Boolean> |
run_normal_mult_perf
Controls normal multiplication performance. |
private static Reference<Boolean> |
run_ping
Controls running ping. |
private static Reference<Boolean> |
run_rsa_exp_check
Controls the RSA exponent check. |
private static Reference<Boolean> |
run_rsa_exp_perf
Controls the RSA exponent performance. |
private static Reference<Boolean> |
run_rsa_vec_exp_check
Controls the RSA vector exponent check. |
private static Reference<Boolean> |
run_rsa_vec_exp_perf
Controls the RSA vector exponent performance. |
private static Reference<Boolean> |
run_short_square_4_mult_perf
Controls the short squared 4 multiplication performance measurements. |
private static Reference<Boolean> |
run_short_squared_mult_perf
Controls the short squared multiplication performance measurements. |
private static Reference<Boolean> |
run_squared_mult_4_check
Controls the squared 4 multiplication check. |
private static Reference<Boolean> |
run_squared_mult_4_perf
Controls the squared 4 multiplication performance. |
private static Reference<Boolean> |
run_squared_mult_check
Controls the squared multiplication check. |
private static Reference<Boolean> |
run_squared_mult_perf
Controls the squared multiplication performance. |
private static Reference<Boolean> |
run_squared_rsa_vec_exp_check
Controls the squared/squared 4 RSA vector exponent check. |
private static Reference<Boolean> |
run_squared_rsa_vec_exp_perf
Controls the squared/squared 4 RSA vector exponent performance. |
private static Reference<Boolean> |
run_subtract_perf
Controls subtraction perfomrance Set by option -subtract-perf . |
private static Reference<Boolean> |
run_vec_exp_check
Controls the vector exponent check. |
private static Reference<Boolean> |
run_vec_exp_perf
Controls the vector exponent performance. |
static String |
short_application_name
Short application name. |
private static Reference<Card_terminal.Terminal_type> |
terminal_type
Terminal type to connect to. |
private static Card_terminal.Terminal_type |
terminal_type_default
Default terminal type. |
private static Charset |
us_ascii
US-ASCII charset for string-to-applet-ID conversion. |
Constructor Summary | |
---|---|
protected |
Test_host()
Static class, object creation disabled. |
Method Summary | |
---|---|
static void |
list_applets(CardChannel channel,
PrintWriter out)
List all applets. |
static void |
main_ex(String[] args)
Real main method. |
static void |
main(String[] args)
Entry point. |
static APDU_Serializable[] |
make_installation_arguments(String cap_file_name)
Create the array of installation arguments for the test applet, see Test_applet.install . |
static void |
open_test_applet(CardChannel card_channel,
Test_protocols test_protocols,
PrintWriter out)
Select the test applet on the card. |
static void |
print_applet_status(PrintWriter out,
Misc_protocols_stubs.Status_result stat)
Print applet status to out. |
static void |
reinstall_applet(CardChannel channel,
PrintWriter out)
(Re-)Install the test applet. |
static void |
run_tests(String[] args,
Test_protocols test_protocols,
CardChannel card_channel)
Run all requested tests and performance measurements. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String short_application_name
public static final String long_application_name
private static final int all_checks_rounds
-all-checks
option.
private static Reference<Boolean> run_all_checks
-all-checks
.
private static Reference<Boolean> run_ping
-ping
.
private static Reference<Boolean> run_data_check
-data-check
.
private static Reference<Boolean> run_data_perf
-data-perf
.
private static Reference<Boolean> run_mont_mult_check
-mont-mult-check
.
private static Reference<Boolean> run_mont_mult_perf
-mont-mult-perf
.
private static Reference<Boolean> run_div_check
-div
.
private static Reference<Boolean> run_div_perf
-div-perf
.
private static Reference<Boolean> run_vec_exp_check
-vec-exp-check
.
private static Reference<Boolean> run_vec_exp_perf
-vec-exp-perf
.
private static Reference<Boolean> run_rsa_vec_exp_check
-rsa-vec-exp-check
.
private static Reference<Boolean> run_rsa_vec_exp_perf
-rsa-vec-exp-perf
.
private static Reference<Boolean> run_squared_rsa_vec_exp_check
-squared-vec-exp-check
.
private static Reference<Boolean> run_squared_rsa_vec_exp_perf
-squared-vec-exp-perf
.
private static Reference<Boolean> run_rsa_exp_check
-rsa-exp-check
.
private static Reference<Boolean> run_rsa_exp_perf
-rsa-exp-perf
.
private static Reference<Boolean> run_squared_mult_check
-squared-mult-check
.
private static Reference<Boolean> run_squared_mult_perf
-squared-mult-perf
.
private static Reference<Boolean> run_short_squared_mult_perf
-short-squared-mult-perf
.
private static Reference<Boolean> run_squared_mult_4_check
-squared-mult-4-check
.
private static Reference<Boolean> run_squared_mult_4_perf
-squared-mult-4-perf
.
private static Reference<Boolean> run_short_square_4_mult_perf
-short-square-4-mult-perf
.
private static Reference<Boolean> run_add_perf
-add-perf
.
private static Reference<Boolean> run_normal_mult_perf
-normal-mult-perf
.
private static Reference<Boolean> run_subtract_perf
-subtract-perf
.
private static Reference<Boolean> run_mem_size
-mem-size
.
private static Reference<Boolean> run_list_readers
-list-readers
.
private static Reference<Boolean> run_list_applets
-list-applets
.
private static Reference<Boolean> reinstall_applet
-reinstall
.
private static Reference<Boolean> keep_applet
-keep-applet
.
private static final Charset us_ascii
private static final Card_terminal.Terminal_type terminal_type_default
Card_terminal.Terminal_type.JCOP_EMULATOR
if the necessary libraries for
connecting to the jcop emulator are available. Initialized to
Card_terminal.Terminal_type.PCSC_TERMINAL
otherwise.
private static Reference<Card_terminal.Terminal_type> terminal_type
-jcop, -sun, -c
and -r
.
private static Reference<Integer> jcop_port_number
private static Reference<Integer> card_reader_number
-r
.
private static SimpleDateFormat date_format
public static Option[] options
Constructor Detail |
---|
protected Test_host()
Method Detail |
---|
public static void run_tests(String[] args, Test_protocols test_protocols, CardChannel card_channel)
args
- the complete command line, as received in main
test_protocols
- instance with all test protocolscard_channel
- communicaion channel to the test applet
(which must have been selected before)public static void list_applets(CardChannel channel, PrintWriter out) throws CardException
out
.
channel
- communication channel to the cardout
- output channel for progress and the applet list
CardException
- for communication problemspublic static APDU_Serializable[] make_installation_arguments(String cap_file_name)
Test_applet.install
. The
installation arguments are the short bignat size (State.short_bignat_max_size
), the long bignat size (State.long_bignat_max_size
), the double-sized bignat size
(State.double_bignat_max_size
), the
base/exponent vector length (State.max_vector_length
),
and the creation time of the applet cap file as 8-byte byte
array, which carries the long value as returned by File.lastModified()
.
cap_file_name
- applet cap file name
public static void reinstall_applet(CardChannel channel, PrintWriter out) throws CardException, IOException
State.test_card_applet_file
on the card. If a package with
name State.test_card_package_name
is on the card, it is
deleted before. If applet listing has been enabled, the
installed applets are printed to out
at the end.
channel
- communication channel to the cardout
- output channel for progress and status messages
CardException
- for communication errors
IOException
- if the cap file cannot be openedpublic static void print_applet_status(PrintWriter out, Misc_protocols_stubs.Status_result stat)
out
- output channelstat
- applet status recordpublic static void open_test_applet(CardChannel card_channel, Test_protocols test_protocols, PrintWriter out) throws CardException, IOException
card_channel
- channel to the cardtest_protocols
- the protocol array instanceout
- progress and debug channel, if null, only
minimalistic messages are printed on System.out
.
CardException
- on communication errors
IOException
- if the cap file cannot be accessedpublic static void main_ex(String[] args) throws CardException, IOException
args
- the complete command line options
CardException
- for card communication errors
IOException
- on IO errors (eg, for the applet cap file)public static void main(String[] args) throws CardException, IOException
main_ex
.
args
- the complete command line options
IOException
- on IO errors (eg, for the applet cap file)
CardException
- for communication errors
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |