Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Cryptix V3.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## java.security.interfaces
Interface ElGamalKeyPairGenerator

All Known Implementing Classes:
  BaseElGamalKeyPairGenerator

public interface ElGamalKeyPairGenerator

An interface to an object capable of generating ElGamal key pairs. The generator is first initialized, then used to generate one or more key pairs.

Users wishing to indicate the prime or base, and to generate a key pair suitable for use with the ElGamal signature or encryption algorithms typically

1. Get a key pair generator for the ElGamal algorithms by calling the KeyPairGenerator `getInstance` method with "ElGamal" as its argument.

2. Initialize the generator by casting the result to an ElGamalKeyPairGenerator and calling one of the `initialize` methods from this ElGamalKeyPairGenerator interface.

3. Generate one or more key pairs by calling the `generateKeyPair` method from the KeyPairGenerator class, as often as desired.

Note: it is not always necessary to do algorithm-specific initialization for an ElGamal key pair generator. That is, it is not always necessary to call one of the `initialize` methods in this interface. Algorithm-independent initialization using the `initialize` method in the KeyPairGenerator interface is all that is needed when you accept defaults for algorithm-specific parameters.

$Revision: 1.1.1.1 $

Since:
  IJCE 1.0.1
Author:
  David Hopwood
See Also:
  `KeyPairGenerator`

Method Summary
`ElGamalParams` | `generateParams(int primeLen, SecureRandom random)` Generates new parameters, p and g.
`void` | `initialize(java.math.BigInteger prime, java.math.BigInteger base, SecureRandom random)` Initializes the key pair generator using the specified prime and base.
`void` | `initialize(ElGamalParams params, SecureRandom random)` Initializes the key pair generator using the prime and base from the specified ElGamalParams object.
`void` | `initialize(int primeLen, boolean genParams, SecureRandom random)` Initializes the key pair generator for a given prime length, without parameters.

Method Detail

### initialize

    public void initialize(ElGamalParams params,
                           SecureRandom random)
                    throws InvalidParameterException

  Initializes the key pair generator using the prime and base from the specified ElGamalParams object.
  Parameters:
    `params` - the parameters to use to generate the keys.
    `random` - the random bit source to use to generate key bits.
  Throws:
    InvalidParameterException - if the parameters passed are invalid.

### initialize

    public void initialize(java.math.BigInteger prime,
                           java.math.BigInteger base,
                           SecureRandom random)
                    throws InvalidParameterException

  Initializes the key pair generator using the specified prime and base. The difficulty of cracking ElGamal by solving the discrete logarithm problem is dependent on the length of the prime. An InvalidParameterException will be thrown if the base is not less than the prime.
  Parameters:
    `prime` - the prime to be used, as a java.math.BigInteger
    `base` - the base to be used, as a java.math.BigInteger
    `random` - the random bit source to use to generate key bits.
  Throws:
    InvalidParameterException - if the parameters passed are invalid.

### initialize

    public void initialize(int primeLen,
                           boolean genParams,
                           SecureRandom random)
                    throws InvalidParameterException

  Initializes the key pair generator for a given prime length, without parameters.

  If genParams is true, this method will generate new p and g parameters. If it is false, the method will use precomputed parameters for the prime length requested. If there are no precomputed parameters for that prime length, an exception will be thrown. It is guaranteed that there will always be default parameters for prime lengths of 513, 1025, 1537 and 2049 bits.

  Parameters:
    `primeLen` - the prime length, in bits. Valid lengths are any integer >= 512.
    `random` - the random bit source to use to generate key bits.
    `genParams` - whether to generate new parameters for the prime length requested.
  Throws:
    InvalidParameterException - if the prime length is less than 512, or if genParams is false and there are not precomputed parameters for the prime length requested.

### generateParams

    public ElGamalParams generateParams(int primeLen,
                                        SecureRandom random)
                                 throws InvalidParameterException

  Generates new parameters, p and g. This method does not change the parameters currently being used by `generateKeyPair`.
  Parameters:
    `primeLen` - the prime length, in bits. Valid lengths are any integer >= 512.
    `random` - the random bit source to use to generate the parameters.
  Throws:
    InvalidParameterException - if the prime length is less than 512.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Cryptix V3.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) 1995-2000 The Cryptix Foundation Ltd. All rights reserved.