Class javax.crypto.KeyGenerator
All Packages Class Hierarchy This Package Previous Next Index
Class javax.crypto.KeyGenerator
java.lang.Object
|
+----javax.crypto.KeyGenerator
- public class KeyGenerator
- extends Object
-
ident
-
-
KeyGenerator(KeyGeneratorSpi, Provider, String)
- Creates a KeyGenerator object using the given provider,
KeyGeneratorSpi and for the specified algorithm.
-
generateKey()
- Generates a secret key.
-
getAlgorithm()
- Returns the standard name of the key algorithm.
-
getInstance(String)
- Generates a KeyGenerator object for the specified key algorithm.
-
getInstance(String, String)
- Generates a KeyGenerator object for the specified key algorithm from
the specified provider.
-
getProvider()
- Returns the provider of this KeyGenerator object.
-
init(AlgorithmParameterSpec)
- Initialises the key generator with the specified parameter set,
using a system-provided source of randomness.
-
init(AlgorithmParameterSpec, SecureRandom)
- Initialises the key generator with the specified parameter set
and a user-provided source of randomness.
-
init(SecureRandom)
- Initialises the key generator.
ident
public final static String ident
KeyGenerator
protected KeyGenerator(KeyGeneratorSpi spi,
Provider provider,
String algorithm)
- Creates a KeyGenerator object using the given provider,
KeyGeneratorSpi and for the specified algorithm.
- Parameters:
- spi - the KeyGeneratorSpi to use
- provider - the provider to use
- algorithm - the standard name of the key algorithm. See
Appendix A in the Java Cryptography Architecture API
Specification & Reference for information about standard
algorithm names.
getAlgorithm
public final String getAlgorithm()
- Returns the standard name of the key algorithm. See Appendix A in
the Java Cryptography Architecture API Specification & Reference
for information about standard algorithm names.
- Returns:
- the standard algorithm name.
getInstance
public static KeyGenerator getInstance(String algorithm) throws NoSuchAlgorithmException
- Generates a KeyGenerator object for the specified key algorithm.
- Parameters:
- algorithm - the standard name of the requested key algorithm.
See Appendix A in the Java Cryptography Architecture API
Specification & Reference for information about standard
algorithm names.
- Returns:
- the new KeyGenerator object
- Throws: NoSuchAlgorithmException
- if a key generator for the
requested algorithm is not available.
getInstance
public static KeyGenerator getInstance(String algorithm,
String provider) throws NoSuchAlgorithmException, NoSuchProviderException
- Generates a KeyGenerator object for the specified key algorithm from
the specified provider.
- Parameters:
- algorithm - the standard name of the requested key algorithm.
See Appendix A in the Java Cryptography Architecture API
Specification & Reference for information about standard
algorithm names.
- Returns:
- the new KeyGenerator object
- Throws: NoSuchAlgorithmException
- if a key generator for the
requested algorithm is not available.
- Throws: NoSuchProviderException
- if the requested provider is
not available
- See Also:
- Provider
getProvider
public final Provider getProvider()
- Returns the provider of this KeyGenerator object.
- Returns:
- the provider of this KeyGenerator object
init
public void init(SecureRandom random)
- Initialises the key generator.
- Parameters:
- random - the source of randomness for this generator.
init
public void init(AlgorithmParameterSpec params) throws InvalidAlgorithmParameterException
- Initialises the key generator with the specified parameter set,
using a system-provided source of randomness.
- Parameters:
- params - the key generation parameters
- Throws: InvalidAlgorithmParameterException
- if the given
parameters are inappropriate for this key generator.
init
public void init(AlgorithmParameterSpec params,
SecureRandom random) throws InvalidAlgorithmParameterException
- Initialises the key generator with the specified parameter set
and a user-provided source of randomness.
- Parameters:
- params - the key generation parameters
- random - the source of randomness for this key generator
- Throws: InvalidAlgorithmParameterException
- if params is
inappropriate for this key generator.
generateKey
public SecretKey generateKey()
- Generates a secret key.
- Returns:
- the new key
All Packages Class Hierarchy This Package Previous Next Index