java.security
public abstract class KeyPairGenerator extends KeyPairGeneratorSpi
KeyPairGenerator is a class used to generate key-pairs for a
 security algorithm.
 
 The KeyPairGenerator is created with the
 getInstance() Factory methods. It is used to generate a pair of
 public and private keys for a specific algorithm and associate this key-pair
 with the algorithm parameters it was initialized with.
See Also: KeyPair AlgorithmParameterSpec
| Constructor Summary | |
|---|---|
| protected | KeyPairGenerator(String algorithm) 
 Constructs a new instance of  KeyPairGenerator. | 
| Method Summary | |
|---|---|
| KeyPair | generateKeyPair() 
 Generates a new "DSA" {@link KeyPair} from the "GNU" security provider.
 
  | 
| KeyPair | genKeyPair() 
 Generates a new "DSA" {@link KeyPair} from the "GNU" security provider.
 
  | 
| String | getAlgorithm() 
 Returns the name of the algorithm used.
 | 
| static KeyPairGenerator | getInstance(String algorithm) 
 Returns a new instance of  KeyPairGeneratorwhich generates
 key-pairs for the specified algorithm. | 
| static KeyPairGenerator | getInstance(String algorithm, String provider) 
 Returns a new instance of  KeyPairGeneratorwhich generates
 key-pairs for the specified algorithm from a named provider. | 
| static KeyPairGenerator | getInstance(String algorithm, Provider provider) 
 Returns a new instance of  KeyPairGeneratorwhich generates
 key-pairs for the specified algorithm from a designated {@link Provider}. | 
| Provider | getProvider() 
 Returns the {@link Provider} of this instance.
 | 
| void | initialize(int keysize) 
 Initializes this instance for the specified key size.  | 
| void | initialize(int keysize, SecureRandom random) 
 Initializes this instance for the specified key size and
 {@link SecureRandom}.
 | 
| void | initialize(AlgorithmParameterSpec params) 
 Initializes this instance with the specified
 {@link AlgorithmParameterSpec}.  | 
| void | initialize(AlgorithmParameterSpec params, SecureRandom random) 
 Initializes this instance with the specified {@link AlgorithmParameterSpec}
 and {@link SecureRandom}.
 | 
KeyPairGenerator.
Parameters: algorithm the algorithm to use.
This method generates a unique key pair each time it is called.
Returns: a new unique {@link KeyPair}.
See Also: genKeyPair
This method generates a unique key-pair each time it is called.
Returns: a new unique {@link KeyPair}.
Since: 1.2
See Also: generateKeyPair
Returns: the name of the algorithm used.
KeyPairGenerator which generates
 key-pairs for the specified algorithm.
Parameters: algorithm the name of the algorithm to use.
Returns: a new instance repesenting the desired algorithm.
Throws: NoSuchAlgorithmException if the algorithm is not implemented by any
           provider. IllegalArgumentException if algorithm is
           null or is an empty string. 
KeyPairGenerator which generates
 key-pairs for the specified algorithm from a named provider.
Parameters: algorithm the name of the algorithm to use. provider the name of a {@link Provider} to use.
Returns: a new instance repesenting the desired algorithm.
Throws: NoSuchAlgorithmException if the algorithm is not implemented by the
           named provider. NoSuchProviderException if the named provider was not found. IllegalArgumentException if either algorithm or
           provider is null or empty. 
KeyPairGenerator which generates
 key-pairs for the specified algorithm from a designated {@link Provider}.
Parameters: algorithm the name of the algorithm to use. provider the {@link Provider} to use.
Returns: a new insatnce repesenting the desired algorithm.
Throws: NoSuchAlgorithmException
           if the algorithm is not implemented by the {@link Provider}. IllegalArgumentException if either algorithm or
           provider is null, or if
           algorithm is an empty string. 
Since: 1.4
See Also: Provider
Returns: the {@link Provider} of this instance.
Parameters: keysize the size of keys to use.
Parameters: keysize the size of keys to use. random the {@link SecureRandom} to use.
Since: 1.2
Parameters: params the {@link AlgorithmParameterSpec} to use.
Throws: InvalidAlgorithmParameterException if the designated specifications are invalid.
Since: 1.2
Parameters: params the {@link AlgorithmParameterSpec} to use. random the {@link SecureRandom} to use.
Throws: InvalidAlgorithmParameterException if the designated specifications are invalid.
Since: 1.2