ds.ov2.test
Class Misc_protocols_host

java.lang.Object
  extended by ds.ov2.test.Misc_protocols_host

 class Misc_protocols_host
extends Object

This class contains the host driver code for the misc protocols, which are ping, set_size, mem_size and status.

CPP Preprocessing
no cpp preprocessing needed
Execution Environment:
host
Author:
Hendrik Tews
Version:
$Revision: 1.4 $
Last Commit:
$Date: 2009-06-02 09:56:02 $ by $Author: tews $

Field Summary
private  CardChannel card_channel
          The channel to the card.
private  PrintWriter out
          Channel for debug and progress messages.
private  Misc_protocols_stubs stubs
          Card communication stubs.
private  Test_protocols test_protocols
          The protocol array instance of the host to set the result sizes after the resize protocol.
 
Constructor Summary
Misc_protocols_host(Test_protocols test_protocols, CardChannel card_channel, PrintWriter out)
          Constructor.
 
Method Summary
 Misc_protocols_stubs.Status_result get_applet_stat()
          Run the status protocol to retrieve the timestamp and the maximal bignat sizes from the applet.
 Misc_protocols_stubs.Mem_size_result get_mem_size()
          Run the memory-size protocol to obtain the amount of available memory on the card.
 long ping()
          Ping the test applet.
 void report_mem_size()
          Run the memory-size protocol and report the results on out.
 void run_ping()
          Ping the test applet with exception printing.
 void set_long_cipher_size(int long_bignat_size, int cipher_size)
          Special resize method for long bignats and RSA_exponent's.
 void set_long_size(int long_bignat_size)
          Special resize method only for long bignats.
 void set_size(int short_bignat_size, int long_bignat_size, int double_bignat_size, int cipher_size)
          General resize method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

test_protocols

private Test_protocols test_protocols
The protocol array instance of the host to set the result sizes after the resize protocol.


stubs

private Misc_protocols_stubs stubs
Card communication stubs.


card_channel

private CardChannel card_channel
The channel to the card.


out

private PrintWriter out
Channel for debug and progress messages.

Constructor Detail

Misc_protocols_host

public Misc_protocols_host(Test_protocols test_protocols,
                           CardChannel card_channel,
                           PrintWriter out)
Constructor. Initializes all fields.

Parameters:
test_protocols - protocol array instance
card_channel - channel to the applet
out - print writer for debug and progress messages
Method Detail

set_size

public void set_size(int short_bignat_size,
                     int long_bignat_size,
                     int double_bignat_size,
                     int cipher_size)
              throws CardException
General resize method. See Resize. Resizes all registered items in the applet and in the host driver to the given new sizes. Reinitializes the protocol array as needed afterwards.

Parameters:
short_bignat_size - new size for registered short bignats
long_bignat_size - new size for registered long bignats
double_bignat_size - new size for registered double-sized bignats
cipher_size - new size for registered RSA_exponent's, if cipher_size == 0 the underlying RSA ciphers will not be resized
Throws:
CardException - on communication errors

set_long_cipher_size

public void set_long_cipher_size(int long_bignat_size,
                                 int cipher_size)
                          throws CardException
Special resize method for long bignats and RSA_exponent's. Short and double-sized bignats will be resized to some unspecified valid value.

Parameters:
long_bignat_size - new size for registered long bignats
cipher_size - new size for registered RSA_exponent's, if cipher_size == 0 the underlying RSA ciphers will not be resized
Throws:
CardException - on communication errors

set_long_size

public void set_long_size(int long_bignat_size)
                   throws CardException
Special resize method only for long bignats. Short and double-sized bignats will be resized to some unspecified valid value. RSA_exponent's will be left as is.

Parameters:
long_bignat_size - new size for registered long bignats
Throws:
CardException - on communication errors

get_mem_size

public Misc_protocols_stubs.Mem_size_result get_mem_size()
                                                  throws CardException
Run the memory-size protocol to obtain the amount of available memory on the card.

Returns:
record with amount of free memory
Throws:
CardException - on communication errors

report_mem_size

public void report_mem_size()
Run the memory-size protocol and report the results on out.


get_applet_stat

public Misc_protocols_stubs.Status_result get_applet_stat()
                                                   throws CardException
Run the status protocol to retrieve the timestamp and the maximal bignat sizes from the applet. This data is initialized during applet initialization. The timestamp is initialized with the last modification date of the applet cap file.

Returns:
status record
Throws:
CardException - on communication errors

ping

public long ping()
          throws CardException
Ping the test applet.

Throws:
CardException - on communication errors

run_ping

public void run_ping()
Ping the test applet with exception printing. This method is an exception wrapper around ping().