APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.crypto.provider

public final Class AESKeyGenerator

extends KeyGeneratorSpi
Class Inheritance
Imports
java.security.InvalidAlgorithmParameterException, .InvalidParameterException, .SecureRandom, java.security.spec.AlgorithmParameterSpec, java.util.Arrays, javax.crypto.KeyGeneratorSpi, .SecretKey, javax.crypto.spec.SecretKeySpec, sun.security.util.SecurityProviderConstants

This class generates an AES key.
Author
Valerie Peng

Field Summary

Modifier and TypeField and Description
private int
private SecureRandom

Constructor Summary

AccessConstructor and Description
public
AESKeyGenerator()

Empty constructor.

Method Summary

Modifier and TypeMethod and Description
protected SecretKey

Returns:

the new AES key
engineGenerateKey
()

Implements abstract javax.crypto.KeyGeneratorSpi.engineGenerateKey.

Generates the AES key.

protected void
engineInit(SecureRandom
the source of randomness for this generator
random
)

Implements abstract javax.crypto.KeyGeneratorSpi.engineInit.

Initializes this key generator.

protected void
engineInit(AlgorithmParameterSpec
the key generation parameters
params
,
SecureRandom
the source of randomness for this key generator
random
)

Implements abstract javax.crypto.KeyGeneratorSpi.engineInit.

Initializes this key generator with the specified parameter set and a user-provided source of randomness.

protected void
engineInit(int
the keysize. This is an algorithm-specific metric specified in number of bits.
keysize
,
SecureRandom
the source of randomness for this key generator
random
)

Implements abstract javax.crypto.KeyGeneratorSpi.engineInit.

Initializes this key generator for a certain keysize, using the given source of randomness.

Field Detail

keySizeback to summary
private int keySize
randomback to summary
private SecureRandom random

Constructor Detail

AESKeyGeneratorback to summary
public AESKeyGenerator()

Empty constructor.

Method Detail

engineGenerateKeyback to summary
protected SecretKey engineGenerateKey()

Implements abstract javax.crypto.KeyGeneratorSpi.engineGenerateKey.

Generates the AES key.

Returns:SecretKey

the new AES key

engineInitback to summary
protected void engineInit(SecureRandom random)

Implements abstract javax.crypto.KeyGeneratorSpi.engineInit.

Initializes this key generator.

Parameters
random:SecureRandom

the source of randomness for this generator

engineInitback to summary
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException

Implements abstract javax.crypto.KeyGeneratorSpi.engineInit.

Initializes this key generator with the specified parameter set and a user-provided source of randomness.

Parameters
params:AlgorithmParameterSpec

the key generation parameters

random:SecureRandom

the source of randomness for this key generator

Exceptions
InvalidAlgorithmParameterException:
if params is inappropriate for this key generator
engineInitback to summary
protected void engineInit(int keysize, SecureRandom random)

Implements abstract javax.crypto.KeyGeneratorSpi.engineInit.

Initializes this key generator for a certain keysize, using the given source of randomness.

Parameters
keysize:int

the keysize. This is an algorithm-specific metric specified in number of bits.

random:SecureRandom

the source of randomness for this key generator