Class KeyGen
java.lang.Object
|
+--KeyGen
- public class KeyGen
- extends java.lang.Object
class KeyGen generates keys for RSA.
The value of n must be large enough so that it is greater
than the maximum size of the integers that the user plans to encode.
We will be encoding block sizes of 11 bytes
Constructor Summary |
KeyGen()
Constructs a new KeyGen
Postcondition
A KeyGen has been created containing the values necessary to
encode and decode. |
KeyGen(java.util.Random r1,
java.util.Random r2)
Constructs a new KeyGen |
Method Summary |
java.math.BigInteger |
getd()
Accessor methods for d, e, n |
java.math.BigInteger |
gete()
|
java.math.BigInteger |
getn()
|
static void |
main(java.lang.String[] args)
Tests the KeyGen class |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
KeyGen
public KeyGen(java.util.Random r1,
java.util.Random r2)
- Constructs a new KeyGen
- Parameters:
r1,
- r2
These contain two random numbers to be used in generating the
exponent and modulus. See BigInteger documentation.
- Postcondition
-
A KeyGen has been created containing the values necessary to
encode and decode.
- Throws:
- OutOfMemoryError - Indicates that there is insufficient memory for a new KeyGen.
KeyGen
public KeyGen()
- Constructs a new KeyGen
- Postcondition
-
A KeyGen has been created containing the values necessary to
encode and decode.
- Throws:
- OutOfMemoryError - Indicates that there is insufficient memory for a new KeyGen.
getd
public java.math.BigInteger getd()
- Accessor methods for d, e, n
- Parameters:
none
- - Returns:
- Returns the decoding exponent, the encoding exponent, or the
modulus
gete
public java.math.BigInteger gete()
getn
public java.math.BigInteger getn()
main
public static void main(java.lang.String[] args)
- Tests the KeyGen class
- Parameters:
args[]
- This parameter will be left empty
- Postcondition
-
The encoding and decoding exponents and the modulus will be printed.
- Throws:
- OutOfMemoryError - Indicates that there is insufficient memory for a new KeyGen,