de.cscc.crypto.provider
Class RSAKeyPairGeneratorEngine

java.lang.Object
  extended byjava.security.KeyPairGeneratorSpi
      extended byde.cscc.crypto.provider.RSAKeyPairGeneratorEngine

public final class RSAKeyPairGeneratorEngine
extends KeyPairGeneratorSpi

RSAKeyPairGeneratorEngine Class.

Defaults are:

  1. public Exponent = F4 (Forth Fermat number (2^2^4)+1 = 65537 or 0x00010001)
  2. keysize (modulus length) = 768 bit
    Note: The keysize must be a positive multiple of 256 and equals or greater than 768.
  3. random = new java.security.SecureRandom()

Version:
$Revision: 1.10 $
Author:
Uwe Günther

Constructor Summary
RSAKeyPairGeneratorEngine()
          Creates new RSAKeyPairGeneratorEngine
 
Method Summary
 KeyPair generateKeyPair()
          Generates a KeyPair.
 void initialize(AlgorithmParameterSpec params, SecureRandom random)
          Initializes the key pair generator using the specified parameter set and user-provided source of randomness.
 void initialize(int keysize, SecureRandom random)
          Initializes the key pair generator for a certain keysize, using the default parameter set.
 String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RSAKeyPairGeneratorEngine

public RSAKeyPairGeneratorEngine()
Creates new RSAKeyPairGeneratorEngine

Method Detail

toString

public String toString()
Returns a string representation of the object.

Returns:
a string representation of the object.

initialize

public void initialize(int keysize,
                       SecureRandom random)
Initializes the key pair generator for a certain keysize, using the default parameter set. If random is null we use the SecureRandom implementation of the highest-priority installed provider as the source of randomness. (If none of the installed providers supply an implementation of SecureRandom, a system-provided source of randomness is used.)

Note: If there a reinitialization with a null reference for random we use the existing random object, that was valid before reinitialization.

Parameters:
keysize - the keysize. The keysize must be a positive multiple of 256 and equals or greater than 768.
random - the source of randomness for this generator. If random is null we use the the SecureRandom implementation of the highest-priority installed provider as the source of randomness. (If none of the installed providers supply an implementation of SecureRandom, a system-provided source of randomness is used.)
Throws:
InvalidParameterException - if the keysize is not equals or geater than 768 and a multible of 256. Where the unit is bit.

initialize

public void initialize(AlgorithmParameterSpec params,
                       SecureRandom random)
                throws InvalidAlgorithmParameterException
Initializes the key pair generator using the specified parameter set and user-provided source of randomness. You have to use RSAKeyGenParameterSpec as AlgorithmParamterSpec. RSAKeyGenParameterSpec does support int keysize and BigInteger publicExponent. The keysize must be 768 or greater and a multible of 256.

So that keysize satisfies the equation:

The possible values for publicExponent are:

Note: If there a reinitialization with a null reference for random we use the existing random object, that was valid before reinitialization.

Parameters:
params - the parameter set used to generate the keys.
random - the source of randomness for this generator.
Throws:
InvalidAlgorithmParameterException - if the keysize is not equals or geater than 768 and a multible of 256. Where the unit is bit. Or if the publicExponent isn't F0 or F4.
See Also:
RSAKeyGenParameterSpec

generateKeyPair

public KeyPair generateKeyPair()
Generates a KeyPair. Unless an initialization method is called using a KeyPairGenerator interface, algorithm-specific defaults will be used. This will generate a new key pair every time it is called. The defaults are keysize = 768 bit and random with the SecureRandom implementation of the highest-priority installed provider as the source of randomness. (If none of the installed providers supply an implementation of SecureRandom, a system-provided source of randomness is used.)

Returns:
the newly generated KeyPair


Copyright © 2001, 2002 by Uwe Günther. See the COPYING file for more details. Browse the source as HTML.