All Packages Class Hierarchy This Package Previous Next Index
Interface java.security.interfaces.ElGamalKeyPairGenerator
- 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
- Get a key pair generator for the ElGamal algorithms by calling the
KeyPairGenerator
getInstance
method with "ElGamal"
as its argument.
- Initialize the generator by casting the result to an
ElGamalKeyPairGenerator and calling one of the
initialize
methods from this ElGamalKeyPairGenerator interface.
- 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 $
- Author:
- David Hopwood
- See Also:
- KeyPairGenerator
-
generateParams(int, SecureRandom)
- Generates new parameters, p and g.
-
initialize(BigInteger, BigInteger, SecureRandom)
- Initializes the key pair generator using the specified prime and
base.
-
initialize(ElGamalParams, SecureRandom)
- Initializes the key pair generator using the prime and base from
the specified ElGamalParams object.
-
initialize(int, boolean, SecureRandom)
- Initializes the key pair generator for a given prime length,
without parameters.
initialize
public abstract 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 abstract void initialize(BigInteger prime,
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 abstract 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 abstract 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.
All Packages Class Hierarchy This Package Previous Next Index