|
Cryptix V3.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.security.KeyPairGeneratorSpi | +--java.security.KeyPairGenerator | +--cryptix.provider.elgamal.BaseElGamalKeyPairGenerator
A class 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.
generateKeyPair
method, as often as desired.
The algorithm used to generate ElGamal keys is as follows:
If p and g are specified in advance then only the last two steps are needed.
References:
Copyright © 1997
Systemics Ltd on behalf of the
Cryptix Development Team.
All rights reserved.
$Revision: 1.6 $
KeyPairGenerator
Field Summary | |
protected java.math.BigInteger |
g
|
protected java.math.BigInteger |
p
|
protected java.security.SecureRandom |
source
|
Constructor Summary | |
BaseElGamalKeyPairGenerator()
|
Method Summary | |
java.security.KeyPair |
generateKeyPair()
Generates a key pair. |
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)
Initialises the key pair generator using the specified prime (p) and base (g). |
void |
initialize(ElGamalParams params,
java.security.SecureRandom random)
Initialises the key pair generator using the prime and base from the specified ElGamalParams object. |
void |
initialize(int primeLen,
boolean genParams,
java.security.SecureRandom random)
Initialises the key pair generator for a given prime length, without parameters. |
void |
initialize(int primeLen,
java.security.SecureRandom random)
Initialises the key pair generator for a given prime length, without parameters. |
Methods inherited from class java.security.KeyPairGenerator |
genKeyPair,
getAlgorithm,
getInstance,
getInstance,
getProvider,
initialize,
initialize,
initialize |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected java.math.BigInteger p
protected java.math.BigInteger g
protected java.security.SecureRandom source
Constructor Detail |
public BaseElGamalKeyPairGenerator()
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.public void initialize(java.math.BigInteger prime, java.math.BigInteger base, java.security.SecureRandom random) throws java.security.InvalidParameterException
An InvalidParameterException will be thrown if base >= prime
.
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.public void initialize(int primeLen, java.security.SecureRandom random)
primeLen
- the prime length, in bits. Valid lengths are any
integer >= 256.random
- the random bit source to use to generate
key bits.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 a prime length of 512 bits.
[Future versions will probably also support 1024, 1536, 2048, 3072, and 4096 bits.]
primeLen
- the prime length, in bits. Valid lengths are any
integer >= 256.random
- the random bit source to use to generate
key bits.genParams
- whether to generate new parameters for the prime
length requested.public java.security.KeyPair generateKeyPair()
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 >= 256.random
- the random bit source to use to generate the parameters.
|
Cryptix V3.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |