|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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
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 $
KeyPairGenerator
Method Summary | |
ElGamalParams |
generateParams(int primeLen,
java.security.SecureRandom random)
Generates new parameters, p and g. |
void |
initialize(java.math.BigInteger prime,
java.math.BigInteger base,
java.security.SecureRandom random)
Initializes the key pair generator using the specified prime and base. |
void |
initialize(ElGamalParams params,
java.security.SecureRandom random)
Initializes the key pair generator using the prime and base from the specified ElGamalParams object. |
void |
initialize(int primeLen,
boolean genParams,
java.security.SecureRandom random)
Initializes the key pair generator for a given prime length, without parameters. |
Method Detail |
public void initialize(ElGamalParams params, java.security.SecureRandom random) throws java.security.InvalidParameterException
params
- the parameters to use to generate the keys.random
- the random bit source to use to generate
key bits.java.security.InvalidParameterException
- if the parameters passed are
invalid.public void initialize(java.math.BigInteger prime, java.math.BigInteger base, java.security.SecureRandom random) throws java.security.InvalidParameterException
prime
- the prime to be used, as a java.math.BigIntegerbase
- the base to be used, as a java.math.BigIntegerrandom
- the random bit source to use to generate
key bits.java.security.InvalidParameterException
- if the parameters passed are
invalid.public void initialize(int primeLen, boolean genParams, java.security.SecureRandom random) throws java.security.InvalidParameterException
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.
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.java.security.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.public ElGamalParams generateParams(int primeLen, java.security.SecureRandom random) throws java.security.InvalidParameterException
generateKeyPair
.primeLen
- the prime length, in bits. Valid lengths are any
integer >= 512.random
- the random bit source to use to generate the parameters.java.security.InvalidParameterException
- if the prime length is less
than 512.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |