|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectds.ov2.front.RSA_host_card
public class RSA_host_card
Host driver for all RSA applets. This
class contains methods for all tasks for these applets. These
methods run the host side of the protocols. This class only covers
the normal protocols. Additional host driver code for the debug
protcol is in RSA_card_debug
.
The code in this class can deal with both, the plain RSA applet and the montgomerizing RSA applet.
There are two different channels where the methods here can show
their progress. First, there is PrintWriter
object out
, initialized in the constructor
, which
will receive progress and debug messages if it is non-null.
Alternatively one can use an instance of RSA_protocol_messages
. This interface specifies about 15 methods
that are if specific points are reached in the protocol.
Field Summary | |
---|---|
private Front_protocols |
front_protocols
Instance with the protocol description classes. |
private PrintWriter |
out
Message output channel. |
private Random |
rand
Randomness source. |
private RSA_card_protocol_stubs |
stubs
IDL compiler generated stubs. |
private int |
verbosity
Requested verbosity of the messages on out . |
Constructor Summary | |
---|---|
RSA_host_card(Front_protocols front_protocols,
RSA_card_protocol_stubs stubs,
PrintWriter out,
int verbosity)
Constructor. |
Method Summary | |
---|---|
boolean |
check_gate(PTLS_rsa_parameters params,
CardChannel card_channel,
RSA_protocol_messages messages,
boolean check_signature)
Run the gate protocol with the card. |
short |
get_montgomery_correction_length(PTLS_rsa_parameters params,
Applet_type applet_type)
The length of the array for the Montgomery correction factors. |
void |
host_side_init(PTLS_rsa_parameters params,
Applet_type applet_type)
Initialize the host-driver copy of the protocols. |
void |
initialize_card(PTLS_rsa_parameters params,
CardChannel card_channel,
RSA_protocol_messages messages,
Applet_type applet_type)
Basic applet initialization. |
boolean |
issue_card(PTLS_rsa_parameters params,
CardChannel card_channel,
RSA_protocol_messages messages,
Applet_type applet_type)
Combined card initialization and personalization. |
boolean |
resign(BigInteger[] updates_bi,
boolean check_signature,
PTLS_rsa_parameters params,
CardChannel card_channel,
RSA_protocol_messages messages)
Run the resign protocol. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final Front_protocols front_protocols
private final RSA_card_protocol_stubs stubs
RSA_card_protocol_stubs
or
RSA_card_protocol_test_stubs
.
private final Random rand
private final PrintWriter out
private final int verbosity
out
. The code
currently distinguishes the verbosity levels 0, 5, 10, and 15.
Level 0 prints only protocol error messages. Higher values
print more.
Constructor Detail |
---|
public RSA_host_card(Front_protocols front_protocols, RSA_card_protocol_stubs stubs, PrintWriter out, int verbosity)
front_protocols
,
stubs
, out
, and verbosity
from its
arguments.
front_protocols
- instance with the protocol description
classesstubs
- delcared of type RSA_CARD_PROTOCOL_STUBS,
the step method stubsout
- the channel for debug and error messages, pass null
to disable such messagesverbosity
- verbosity level on out
, see verbosity
Method Detail |
---|
public short get_montgomery_correction_length(PTLS_rsa_parameters params, Applet_type applet_type)
Bignat_arrays
). On the plain RSA
applet numbers are not montgomerized because of the use of the
RSA cipher there. When multiplying any two such numbers one
needs to multiply an correction factor, see .
The plain applet needs correction factors for 2,3,4,5
as well as for n + 1 and n + 2 factors, where n is the number
of attributes (see PTLS_rsa_parameters.attribute_number
). In the array of the correction factors index 0 stores the correction for two factors. Therefore the length of the array is one less than the maximal needed factor.
applet_type
- the applet type
public void host_side_init(PTLS_rsa_parameters params, Applet_type applet_type)
RSA_data.allocate
with the same parameter on
the card, to fill argument and result arrays of the remaining
protocol steps. Then the delayed protocols and stubs are
initialized.
The debug protocol does also depend on this kind of delayed
initialization, see RSA_card_debug.host_side_init
.
In order to have matching protocl description we have to use the same applet type here as we installed on the card.
params
- the PTLS system parametersapplet_type
- what applet type we have been talking to on
the cardpublic void initialize_card(PTLS_rsa_parameters params, CardChannel card_channel, RSA_protocol_messages messages, Applet_type applet_type) throws CardException
card_channel
. Runs the allocate and
init_data protocols to finish allocation on the applet and
download key material, attributes and whatelse is needed on the
applet. During this initialization the blinding of the card is
set to 1. The signature remains uninitialized and invalid.
The initialization steps are replicated in the host driver as necessary to bring the protocol layer here into the same state as on the card.
This method can initialize both, the plain RSA applet and the Montgomerizing RSA applet.
params
- the PTLS system parameterscard_channel
- communication channel to the applet, an
applet of type applet_type
must have been selected on
that channel beforemessages
- progress message instance, can be nullapplet_type
- what applet type to initialize
CardException
- in case of an communication error with
the cardpublic boolean resign(BigInteger[] updates_bi, boolean check_signature, PTLS_rsa_parameters params, CardChannel card_channel, RSA_protocol_messages messages) throws CardException
updates_bi
. Positive values are added to
the card attribute, negative subtracted.
The addition or subtraction of the update to the current attribute value must not cause an over- or underflow. Otherwise the attribute expression computed here (without knowing the attribute values) will not equal the one on the card and the signature creation will fail.
Normally the signature on the card is checked. The check can be
ommitted, with check_signature
. This is necessary in
the first resign step, which belongs to the card
initialization, because then, the card does not have a valid
signature yet.
The source code of this method is affected by Brand's patents on selective disclosure protocols that are now in the posession of Microsoft. Microsoft lawyers are still pondering our request from January 2009 for making the full source code publically available. The source code of this method is therefore currently not publically available. The detailed operations of this method are:
updates_bi
- the updates in the range between -PTLS_rsa_parameters.v
+ 1 and PTLS_rsa_parameters.v
-1, inclusive.check_signature
- whether to check the signature of the
cardparams
- the PTLS system parameterscard_channel
- communication channel to the appletmessages
- progress message instance
CardException
, although the card accepted the new
signature.
CardException
- in case of communication errors with the
cardpublic boolean issue_card(PTLS_rsa_parameters params, CardChannel card_channel, RSA_protocol_messages messages, Applet_type applet_type) throws CardException
initialize_card
and performs resign step right
afterwards. As a result the card is initialized with an unknown
blinding and valid signature.
This method can issue both, a plain RSA applet and an Montgomerizing RSA applet.
params
- the PTLS system parameterscard_channel
- communication channel to the applet, an
applet of type applet_id
must have been selected on
that channel beforemessages
- the progress message instanceapplet_type
- what applet type to initialize
resign
step succeeded
CardException
- in case of communication errors with the
cardpublic boolean check_gate(PTLS_rsa_parameters params, CardChannel card_channel, RSA_protocol_messages messages, boolean check_signature) throws CardException
The source code of this method is affected by Brand's patents on selective disclosure protocols that are now in the posession of Microsoft. Microsoft lawyers are still pondering our request from January 2009 for making the full source code publically available. The source code of this method is therefore currently not publically available. The detailed operations of this method are:
params
- the PTLS system parameterscard_channel
- communication channel to the appletmessages
- the progress message instancecheck_signature
- whether to check the signature of the
card (should never be false)
CardException
- in case a communication error occors
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |