|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectds.ov2.front.PTLS_rsa_parameters
public class PTLS_rsa_parameters
PTLS parameters. The PTLS parameters are the static parameters that are needed for the OV-chip RSA protocols. They need to be generated once before the system starts. The PTLS parameter set contains the key material as well as the number of attributes and the key length'.
Montgomerization and Demontgomerization factors depend on the RSA
modulus n
and they are therefore included here (in the
host modulus hmod
). However, they also depend on the
number of Montgomery digits and therefore on the applet type. Some
methods here take therefore an applet type argument, although the
PTLS parameters itself are independent of the applet type.
Nested Class Summary | |
---|---|
static class |
PTLS_rsa_parameters.PTLS_io_exception
Exception for I/O problems during reading/writing PTLS parameters from/to disk. |
Field Summary | |
---|---|
int |
attribute_number
The number of attributes. |
BigInteger[] |
base
The array of the bases. |
int |
base_length
Length of the bases and the RSA modulus in bits (long bignats). |
int |
exponent_length
The length of the attributes in bits (short or exponent bignats). |
Host_modulus |
hmod
The RSA modulus wrapped in a host modulus that contains (de-)montgomerization factors as well. |
(package private) BigInteger |
inv_v
1/v, the inverse of v modulus euler_phi(n) |
BigInteger |
n
The RSA modulus, product of two primes. |
private PrintWriter |
out
Output channel for debug and progress messages. |
static int |
prime_certainy
Prime certainy: certainy parameter for probabilistic prime generation. |
private BigInteger |
ptls_private_key
The private key x of the PTLS. |
BigInteger |
ptls_public_key
The public key of the PTLS h = x^v. |
private Random |
rand
Randomness source. |
BigInteger |
v
The RSA exponent v, coprime to euler_phi(n). |
private int |
verbosity
Verbosity level. |
private static String |
version
cvs revision number, kept up to date by cvs keyword substitution. |
Constructor Summary | |
---|---|
PTLS_rsa_parameters(int attribute_number,
PrintWriter out,
int verbosity)
Constructor. |
Method Summary | |
---|---|
private BigInteger[] |
generate_v(BigInteger p,
BigInteger q)
Generate the public RSA exponent v. |
void |
generate(int base_length,
int exponent_length,
Applet_type applet_type)
Generate a new set of PTLS parameters and store them in this instance. |
private static String |
get_next_data(BufferedReader fin)
Retrurn the part after the colon from the next line in the input fin . |
int |
make_base_bytes(int montgomery_digits)
Compute the length of the bases and the RSA modulus in bytes for this instance. |
int |
make_exponent_bytes()
Compute the length of the attributes/exponents in bytes for this instance. |
(package private) void |
print_all(Applet_type applet_type,
PrintWriter out)
Print all parameters in this instance to the given channel. |
static PTLS_rsa_parameters |
read_from_file(String filename,
Applet_type applet_type,
PrintWriter out,
int verbosity)
Create a new PTLS parameter instance by loading file filename . |
void |
write_to_file(String filename)
Write the PTLS parameters in this instance to file filename . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public int base_length
public int exponent_length
public final int attribute_number
public BigInteger n
public Host_modulus hmod
public BigInteger v
BigInteger inv_v
private BigInteger ptls_private_key
public BigInteger ptls_public_key
public BigInteger[] base
attribute_number
.
public static final int prime_certainy
private final Random rand
private PrintWriter out
private int verbosity
private static final String version
Constructor Detail |
---|
public PTLS_rsa_parameters(int attribute_number, PrintWriter out, int verbosity)
attribute_number
- number of attributesout
- debug/progress messagesverbosity
- verbosityMethod Detail |
---|
private BigInteger[] generate_v(BigInteger p, BigInteger q)
p
- first factor of the RSA modulusq
- second factor of the RSA modulus
exponent_length
, prime, and
coprime to phi(p * q)public int make_base_bytes(int montgomery_digits)
montgomery_digits
- number of montgomery digits
public int make_exponent_bytes()
public void generate(int base_length, int exponent_length, Applet_type applet_type) throws NoSuchAlgorithmException
Unsecure_rsa_key
is used.
If compiled with APPLET_TESTFRAME,
and if fixed inputs are available, they are taken as follows.
First two inputs: factors of the RSA modulus n
. Input
number 3: v
. Input number 4: x, the private PTLS key
ptls_private_key
. The next attribute_number
inputs: the bases.
base_length
- length of the bases and the RSA modulus in bitsexponent_length
- length of the attributes (exponents) in bitsapplet_type
- current applet type for determining the
number of Montgomery digits and the (de-)montgomerization
factors
NoSuchAlgorithmException
- if no provider for RSA key
generation can be foundpublic void write_to_file(String filename) throws PTLS_rsa_parameters.PTLS_io_exception
filename
. No compatibility with future and past versions. The
file format is simply ASCII with the numbers as decimal
strings.
filename
- file to write to
PTLS_rsa_parameters.PTLS_io_exception
- if an IO error occursprivate static String get_next_data(BufferedReader fin) throws PTLS_rsa_parameters.PTLS_io_exception
fin
.
fin
- input reader
PTLS_rsa_parameters.PTLS_io_exception
- for read errorspublic static PTLS_rsa_parameters read_from_file(String filename, Applet_type applet_type, PrintWriter out, int verbosity) throws PTLS_rsa_parameters.PTLS_io_exception
filename
.
filename
- file to readapplet_type
- current applet type for determining the
number of Montgomery digits and the (de-)montgomerization
factorsout
- debug/progress channel, may be null to supress outputverbosity
- verbosity level
filename
PTLS_rsa_parameters.PTLS_io_exception
- if the file is not accessable, its
version tag does not match version
, or some other read
error occursvoid print_all(Applet_type applet_type, PrintWriter out)
Only available if TESTFRAME
is defined.
applet_type
- current applet type for determining the
number of Montgomery digits and the (de-)montgomerization
factorsout
- channel to print to
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |