ds.ov2.bignat
Class Fake_rsa_exponent

java.lang.Object
  extended by ds.ov2.bignat.Fake_rsa_exponent
All Implemented Interfaces:
RSA_exponent_interface

public class Fake_rsa_exponent
extends Object
implements RSA_exponent_interface

RSA_exponent_interface implementation for the host. Uses BigInteger internally. Provides nothing more than just BigInteger.modPow with a strange interface.

This class makes it possible to use Vector.mont_rsa_exponent_mod and code that depends on it on the host, for instance in a test frame.

As far as possible other code is written in terms of RSA_exponent_interface to avoid cpp trickery. However, when it comes to constructor calls, there is no way around it. For those few places the cpp macro RSA_EXPONENT is used. It expands to either RSA_exponent or to Fake_rsa_exponent.

For a number of general topics see also the package description.

CPP Preprocessing
no cpp preprocessing needed for this class
Execution Environment:
host
Author:
Hendrik Tews
Version:
$Revision: 1.14 $
Last Commit:
$Date: 2009-05-20 14:16:57 $ by $Author: tews $

Field Summary
private  BigInteger exponent
          The configured exponent.
private  BigInteger modulus
          The configured modulus.
 
Constructor Summary
Fake_rsa_exponent()
          Non-allocating constructor.
Fake_rsa_exponent(short key_byte_size)
          Allocating constructor.
 
Method Summary
 void allocate(short key_byte_size)
          Empty method.
 void fixed_power(Bignat base, Bignat result, short offset)
          Modular power with preconfigured modulus and exponent.
 void init_key(short key_size)
          Empty method.
 void power(Bignat base, Bignat exp, Bignat result, short offset)
          Modular exponent.
 void set_exponent(Bignat exponent, Bignat temp, short offset)
          Saves the exponent exponent for later use in modulus.
 void set_modulus(Bignat mod, short offset)
          Saves the modulus mod for later use in modulus.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

modulus

private BigInteger modulus
The configured modulus. Set in set_modulus.


exponent

private BigInteger exponent
The configured exponent. Set in set_exponent.

Constructor Detail

Fake_rsa_exponent

public Fake_rsa_exponent()
Non-allocating constructor. Empty, because there is nothing to do here.


Fake_rsa_exponent

public Fake_rsa_exponent(short key_byte_size)
Allocating constructor. Calls the non-allocating constructor and allocate as prescribed, although they are all empty.

Parameters:
key_byte_size - ignored argument
Method Detail

init_key

public void init_key(short key_size)
Empty method. Only here to comply with RSA_exponent_interface.

Specified by:
init_key in interface RSA_exponent_interface
Parameters:
key_size - ignored argument

allocate

public void allocate(short key_byte_size)
Empty method. Only here to comply with RSA_exponent_interface.

Specified by:
allocate in interface RSA_exponent_interface
Parameters:
key_byte_size - ignored argument

set_modulus

public void set_modulus(Bignat mod,
                        short offset)
Saves the modulus mod for later use in modulus.

Specified by:
set_modulus in interface RSA_exponent_interface
Parameters:
mod - modulus to use later in exponent
offset - this argument is ignored in this class

set_exponent

public void set_exponent(Bignat exponent,
                         Bignat temp,
                         short offset)
Saves the exponent exponent for later use in modulus.

Specified by:
set_exponent in interface RSA_exponent_interface
Parameters:
exponent - exponent to use later in power or fixed_power
temp - this argument is ignored in this class
offset - this argument is ignored in this class

fixed_power

public void fixed_power(Bignat base,
                        Bignat result,
                        short offset)
Modular power with preconfigured modulus and exponent. Sets result to base^exp mod modulus, where the modulus and exp must have been configured before with set_modulus and set_exponent, respectively.

Specified by:
fixed_power in interface RSA_exponent_interface
Parameters:
base -
result - reference for storing the result
offset - this argument is ignored in this class

power

public void power(Bignat base,
                  Bignat exp,
                  Bignat result,
                  short offset)
Modular exponent. Sets result to base^exp (modulo modulus), where the modulus must have been configured before with set_modulus.

Computations are done with BigInteger, data conversion with Convert_serializable.

Specified by:
power in interface RSA_exponent_interface
Parameters:
base - base
exp - exponent
result - gets the result base^exponent modulo modulus
offset - this argument is ignored in this class