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

public final Class DESKeyGenerator

extends KeyGeneratorSpi
Class Inheritance
Imports
java.security.SecureRandom, .InvalidParameterException, .InvalidAlgorithmParameterException, .InvalidKeyException, java.security.spec.AlgorithmParameterSpec, java.util.Arrays, javax.crypto.KeyGeneratorSpi, .SecretKey, javax.crypto.spec.DESKeySpec

This class generates a DES key.
Author
Jan Luehe

Field Summary

Modifier and TypeField and Description
private SecureRandom

Constructor Summary

AccessConstructor and Description
public
DESKeyGenerator()

Empty constructor

Method Summary

Modifier and TypeMethod and Description
protected SecretKey

Returns:

the new DES key
engineGenerateKey
()

Implements abstract javax.crypto.KeyGeneratorSpi.engineGenerateKey.

Generates the DES 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.

pack-priv static void
setParityBit(byte[] key, int offset)

Field Detail

randomback to summary
private SecureRandom random

Constructor Detail

DESKeyGeneratorback to summary
public DESKeyGenerator()

Empty constructor

Method Detail

engineGenerateKeyback to summary
protected SecretKey engineGenerateKey()

Implements abstract javax.crypto.KeyGeneratorSpi.engineGenerateKey.

Generates the DES key.

Returns:SecretKey

the new DES 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

setParityBitback to summary
pack-priv static void setParityBit(byte[] key, int offset)