de.flexiprovider.ec.keys
Class ECKeyPairGenerator

java.lang.Object
  |
  +--java.security.KeyPairGeneratorSpi
        |
        +--de.flexiprovider.api.keys.KeyPairGenerator
              |
              +--de.flexiprovider.ec.keys.ECKeyPairGenerator

public class ECKeyPairGenerator
extends KeyPairGenerator

This class is used to generate pairs of EC public and private keys. Let G be an Generator with order r, where r is a positiv prime and divides the number of the points of the elliptic curve E. That means, G generates the subgroup of points of E with order r. Then the private key is defined to be s, 1 < s < r and the public key is defined to be W = s * G.

Author:
Birgit Henhapl
See Also:
ECPublicKey, ECPrivateKey

Field Summary
static int DEFAULT_KEY_SIZE
          The default key size (192 bits)
 
Constructor Summary
ECKeyPairGenerator()
           
 
Method Summary
 KeyPair genKeyPair()
          Generate a key pair.
 void initialize(AlgorithmParameterSpec params, SecureRandom random)
          Initialize the key pair generator with the given parameter set (which has to be an instance of CurveParams) and source of randomness.
 void initialize(int keySize, SecureRandom random)
          Initialize the key pair generator with a key size and source of randomness.
 
Methods inherited from class de.flexiprovider.api.keys.KeyPairGenerator
generateKeyPair, initialize, initialize
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_KEY_SIZE

public static final int DEFAULT_KEY_SIZE
The default key size (192 bits)
Constructor Detail

ECKeyPairGenerator

public ECKeyPairGenerator()
Method Detail

initialize

public void initialize(AlgorithmParameterSpec params,
                       SecureRandom random)
                throws InvalidAlgorithmParameterException
Initialize the key pair generator with the given parameter set (which has to be an instance of CurveParams) and source of randomness. If the parameters are null, the default parameters for the DEFAULT_KEY_SIZE are used.
Overrides:
initialize in class KeyPairGenerator
Parameters:
params - the parameters
random - the source of randomness
Throws:
InvalidAlgorithmParameterException - if the parameters are not an instance of CurveParams.

initialize

public void initialize(int keySize,
                       SecureRandom random)
Initialize the key pair generator with a key size and source of randomness. Default curves are registered for certain key sizes. The given key size is rounded up to the next registered key size and the corresponding curve is chosen. In effect, the bit length of the group order of the chosen curve is greater than or equal to the specified key size.
Overrides:
initialize in class KeyPairGenerator
Parameters:
keySize - the key size in bits
random - the source of randomness
Throws:
java.lang.RuntimeException - if the key size is too large and no default curve exist for the specified key size.

genKeyPair

public KeyPair genKeyPair()
Generate a key pair. The key pair consists of the private key, a FlexiBigInt s in the interval [1, r-1], and the public key W, a point of the elliptic curve E over the field GF(q). It is computed as W = s * G, where G, together with E, q and r are EC domain parameters.
Overrides:
genKeyPair in class KeyPairGenerator
Returns:
the generated EC key pair
See Also:
CurveParams, ECPublicKey, ECPrivateKey