|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--javax.crypto.KeyGenerator
Engine class for creating secret keys in algorithm independent manner.
Attention: This is not a SUN implementation!
This class has been developed by IAIK according to the documentation publicly available.
For SUNīs documentation of this class see
http://java.sun.com/security/JCE1.2/spec/apidoc/index.html
This class represents a key generator for creating secret keys for symmetric
algorithms. For creating a KeyGenerator object, an application shall use one
of the getInstance methods, supplied with the particular symmetric
algorithm in mind and (optionally) a particular provider.
For instance:
KeyGenerator key_gen = KeyGenerator.getInstance("DES");
For actually generating the requested secret key from the KeyGenerator object just
created (and initialized with one of the init methods), use the
generateKey method:
For instance:
SecretKey des_key = key_gen.generateKey();
Initializing the key generator maybe done either algorithm-independently with some random seed, or algorithm-specific with some particular algorithm parameter specification. If no explicit initialization is done at all, it is left to the actual provider implementation to take default settings.
getInstance(java.lang.String),
generateKey(),
SecretKey,
SecretKey| Constructor Summary | |
protected |
KeyGenerator(KeyGeneratorSpi keyGenSpi,
Provider provider,
java.lang.String algorithm)
Default Constructor for creating a KeyGenerator object. |
| Method Summary | |
SecretKey |
generateKey()
Actually generates a secret key from this KeyGenerator object. |
java.lang.String |
getAlgorithm()
Returns the standard name of the key algorithm. |
static KeyGenerator |
getInstance(java.lang.String algorithm)
Returns the default provider KeyGenerator implementation for the specified algorithm. |
static KeyGenerator |
getInstance(java.lang.String algorithm,
java.lang.String provider)
Returns a KeyGenerator object for the specified algorithm, implemented by the given provider. |
Provider |
getProvider()
Returns the provider used for creating this KeyGenerator object. |
void |
init(AlgorithmParameterSpec params)
Initializes this key generator with the given algorithm parameters. |
void |
init(AlgorithmParameterSpec params,
SecureRandom random)
Initializes this key generator with given algorithm parameters and random seed. |
void |
init(int strength)
Initializes this key generator for the given strength. |
void |
init(int strength,
SecureRandom random)
Initializes this key generator for the given strength with the given random seed |
void |
init(SecureRandom random)
Initializes this key generator with the given random seed. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Constructor Detail |
protected KeyGenerator(KeyGeneratorSpi keyGenSpi,
Provider provider,
java.lang.String algorithm)
getInstance factory methods for obtaining a KeyGenerator object.keyGenSpi - the SPI KeyGenerator implementation of the actual providerprovider - the provideralgorithm - the algorithm| Method Detail |
public final java.lang.String getAlgorithm()
public static final KeyGenerator getInstance(java.lang.String algorithm)
throws NoSuchAlgorithmException
algorithm - the standard name of the algorithm for which the KeyGenerator is used
public static final KeyGenerator getInstance(java.lang.String algorithm,
java.lang.String provider)
throws NoSuchAlgorithmException,
NoSuchProviderException
algorithm - the standard name of algorithm for which the KeyGenerator is usedprovider - the name of the provider as string.public final Provider getProvider()
public final void init(SecureRandom random)
random - the random seedpublic final void init(int strength)
strength - the strength of the key to be created
public final void init(int strength,
SecureRandom random)
strength - the strength of the key to be createdrandom - the random seed
public final void init(AlgorithmParameterSpec params)
throws InvalidAlgorithmParameterException
params - the algorithm parameters
public final void init(AlgorithmParameterSpec params,
SecureRandom random)
throws InvalidAlgorithmParameterException
params - the algorithm parametersrandom - the random seedpublic final SecretKey generateKey()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||