The KeyPairGenerator class is used to generate pairs of
public and private keys. Key generators are constructed using the
getInstance factory methods (static methods that
return instances of a given class).
Key generation is an area that sometimes
does not lend itself well to algorithm independence. For example,
it is possible to generate a DSA key pair specifying key family
parameters (p, q and g), while it is not possible to do so for
an RSA key pair. That is, those parameters are applicable to DSA
but not to RSA.
There are therefore two ways to generate a key pair: in an
manner, and in an algorithm-specific manner. The only difference
between the two is the initialization of the object.
All key pair generators share the concepts of a "strength" and a
source of randomness. The measure of strength is universally shared
by all algorithms,
though it is interpreted differently for different algorithms.
The initialize method in this
takes these two universally shared
types of arguments.
Since no other parameters are specified when you call this
method, all other values, such as algorithm parameters, public
exponent, etc., are defaulted to standard values.
It is sometimes desirable to initialize a key pair generator object
using algorithm-specific semantics. For example, you may want to
initialize a DSA key generator for a given set of parameters
p, q and g,
or an RSA key generator for a given public exponent.
This is done through algorithm-specific standard interfaces. Rather than
calling the algorithm-independent KeyPairGenerator initialize
method, the key pair generator is cast to an algorithm-specific interface
so that one of its specialized parameter initialization methods can be
called. An example is the DSAKeyPairGenerator interface (from
See The KeyPairGenerator Class
in the "Java Cryptography Architecture API Specification & Reference"
for more information and examples.
Submit a bug or feature - Version 1.1.8 of Java Platform API Specification
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1995-1999 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.