I initialized the key pair generator by specifying the modulus *p* and the generator *g* in my last post. There are a few other ways.

Javadoc for `KeyPairGenerator`

class says in its preface, There are two ways to generate a key pair: in an algorithm-independent manner, and in an algorithm-specific manner. The only difference between the two is the initialization of the object

. It explains how SunJCE works in the case of the algorithm-independent manner, as follows.

If the algorithm is the DSA algorithm, and the keysize (modulus size) is 512, 768, or 1024, then the Sun provider uses a set of precomputed values for the p, q, and g parameters. If the modulus size is not one of the above values, the Sun provider creates a new set of parameters.

This is also applied to the Diffie-Hellman algorithm too.