com.monica.javacom.ciphering
Class RSAKeyPairGenerator

java.lang.Object
  |
  +--com.monica.javacom.ciphering.RSAKeyPairGenerator

public class RSAKeyPairGenerator
extends java.lang.Object

Realizes an RSAKeyPairGenerator. This object is used to create a proper RSAKeyPair for using it in an RSA encoder/decoder. The RSAKeyPair retruned by the generating function must be splitted, and then passed to the RSA object.

See Also:
RSAKeyPair, RSAKey, RSA

Constructor Summary
RSAKeyPairGenerator(int in_keyLength, int in_certainty, int in_publicKey, java.util.Random in_random)
          Constructs a new RSAKeyPairGenerator.
 
Method Summary
 RSAKeyPair generateRSAKeyPair()
          Generates a new RSAKeyPair with the given keyLength, certainty, publicKey and Random object.
 int getCertainty()
          Returns the certainty of the being prime of the modulus components.
 int getKeyLength()
          Returns the keylength of the RSAKeyPair to be generated.
 int getPublicKey()
          Returns the suggested public key of the RSAKeyPair to be generated.
 void setCertainty(int in_certainty)
          Sets the certainty.
 void setKeyLength(int in_keyLength)
          Sets the keylength of the RSAKeyPair to be generated.
 void setPublicKey(int in_publicKey)
          Sets the suggested public key exponent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RSAKeyPairGenerator

public RSAKeyPairGenerator(int in_keyLength,
                           int in_certainty,
                           int in_publicKey,
                           java.util.Random in_random)
                    throws BadInputValueException
Constructs a new RSAKeyPairGenerator. If supplied with a proper Random object, it creates a secure RSAKeyPair.
Parameters:
in_keyLength - the keylength of the RSAKey to be generated - default: 256
in_certainty - the certainty, that the numbers generated are primes, P=1-2^(-certainty) - default: 100
in_publicKey - the suggested publicKey-exponent - default: 65537
in_random - the Random object the RSAKeyPairGenerator will use to generate the random numbers
Throws:
BadInputValueException - the in_keyLength must be between 16 and 65536
BadInputValueException - the in_certainty must be between 1 and 65536
BadInputValueException - the in_publicKey must be odd and greater than 2
Method Detail

generateRSAKeyPair

public RSAKeyPair generateRSAKeyPair()
Generates a new RSAKeyPair with the given keyLength, certainty, publicKey and Random object.
Returns:
a new RSAKeyPair with the given parameters

getKeyLength

public int getKeyLength()
Returns the keylength of the RSAKeyPair to be generated.
Returns:
the keylength of the RSAKeyPair

getCertainty

public int getCertainty()
Returns the certainty of the being prime of the modulus components.
Returns:
the certainty of the being prime

getPublicKey

public int getPublicKey()
Returns the suggested public key of the RSAKeyPair to be generated.
Returns:
the suggested public key of the RSAKeyPair

setKeyLength

public void setKeyLength(int in_keyLength)
                  throws BadInputValueException
Sets the keylength of the RSAKeyPair to be generated.
Parameters:
in_keyLength - the keylength of the RSAKey to be generated - default: 256
Throws:
BadInputValueException - the in_keyLength must be between 16 and 65536

setCertainty

public void setCertainty(int in_certainty)
                  throws BadInputValueException
Sets the certainty.
Parameters:
in_certainty - the certainty, that the numbers generated are primes, P=1-2^(-certainty) - default: 100
Throws:
BadInputValueException - the in_certainty must be between 1 and 65536

setPublicKey

public void setPublicKey(int in_publicKey)
                  throws BadInputValueException
Sets the suggested public key exponent.
Parameters:
in_publicKey - the suggested publicKey-exponent - default: 65537
Throws:
BadInputValueException - the in_publicKey must be odd and greater than 2