public class DHParameterGenerator
extends java.lang.Object
Normally, Diffie-Hellmain parameters are distributed (and generated) by a central agency agreed upon by participating parties, so a DHParameterGenerator
will be invoked far less often than, say, a generator for RSA, DSA (or DH) keypairs.
Parameter generation is also similarly resource intensive: for example, generation of the sample parameters given in Annex D of X9.42 takes about 100 seconds on a Pentium-based JVM.
DHParams
Constructor and Description |
---|
DHParameterGenerator()
Constructs a new, uninitialized
DHParameterGenerator instance. |
Modifier and Type | Method and Description |
---|---|
DHParams |
generateParameters()
Generates Diffie-Hellman parameters using the algorithms specified in Annex B, X9.42.
|
java.lang.String |
getAlgorithm()
Returns "Diffie-Hellman".
|
void |
initialize(int L, int m)
Initialize this
DHParameterGenerator with the given bit lengths for p and q, and the default RandomBitsSource . |
void |
initialize(int L, int m, RandomBitsSource rbs)
Initialize this
DHParameterGenerator of the given bit lengths and RandomBitsSource . |
public DHParameterGenerator()
DHParameterGenerator
instance.public void initialize(int L, int m)
DHParameterGenerator
with the given bit lengths for p and q, and the default RandomBitsSource
.L
- the bit length of p; L=256n, n>=4m
- the bit length of q; m>=160public void initialize(int L, int m, RandomBitsSource rbs)
DHParameterGenerator
of the given bit lengths and RandomBitsSource
.L
- the bit length of p; L=256n, n>=4m
- the bit length of q; m>=160rbs
- the random bit source used to generate the parameterspublic java.lang.String getAlgorithm()
public DHParams generateParameters()
DHParams
object of the specified sizes.