xjava.security.interfaces
public interface ElGamalKeyPairGenerator
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
getInstance
method with "ElGamal"
as its argument.
initialize
methods from this ElGamalKeyPairGenerator interface.
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.2 $
Since: IJCE 1.0.1
See Also: java.security.KeyPairGenerator
Method Summary | |
---|---|
ElGamalParams | generateParams(int primeLen, SecureRandom random)
Generates new parameters, p and g. |
void | initialize(ElGamalParams params, SecureRandom random)
Initializes the key pair generator using the prime and base from
the specified ElGamalParams object.
|
void | initialize(BigInteger prime, BigInteger base, SecureRandom random)
Initializes the key pair generator using the specified prime and
base. |
void | initialize(int primeLen, boolean genParams, SecureRandom random)
Initializes the key pair generator for a given prime length,
without parameters.
|
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.
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.
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.
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.