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" KeyPair from the "GNU" security provider.
|
KeyPair | genKeyPair()
Generates a new "DSA" 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 KeyPairGenerator which generates
key-pairs for the specified algorithm.
|
static KeyPairGenerator | getInstance(String algorithm, String provider)
Returns a new instance of KeyPairGenerator which generates
key-pairs for the specified algorithm from a named provider.
|
static KeyPairGenerator | getInstance(String algorithm, Provider provider)
Returns a new instance of KeyPairGenerator which generates
key-pairs for the specified algorithm from a designated Provider.
|
Provider | getProvider()
Returns the 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
SecureRandom.
|
void | initialize(AlgorithmParameterSpec params)
Initializes this instance with the specified
AlgorithmParameterSpec. |
void | initialize(AlgorithmParameterSpec params, SecureRandom random)
Initializes this instance with the specified AlgorithmParameterSpec
and SecureRandom.
|
KeyPairGenerator
.
Parameters: algorithm the algorithm to use.
This method generates a unique key pair each time it is called.
Returns: a new unique KeyPair.
See Also: genKeyPair
This method generates a unique key-pair each time it is called.
Returns: a new unique 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 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 Provider.
Parameters: algorithm the name of the algorithm to use. provider the Provider to use.
Returns: a new insatnce repesenting the desired algorithm.
Throws: NoSuchAlgorithmException
if the algorithm is not implemented by the Provider. IllegalArgumentException if either algorithm
or
provider
is null
, or if
algorithm
is an empty string.
Since: 1.4
See Also: Provider
Parameters: keysize the size of keys to use.
Parameters: keysize the size of keys to use. random the SecureRandom to use.
Since: 1.2
Parameters: params the AlgorithmParameterSpec to use.
Throws: InvalidAlgorithmParameterException if the designated specifications are invalid.
Since: 1.2
Parameters: params the AlgorithmParameterSpec to use. random the SecureRandom to use.
Throws: InvalidAlgorithmParameterException if the designated specifications are invalid.
Since: 1.2