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

public final Class HmacSHA1KeyGenerator

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

This class generates a secret key for use with the HMAC-SHA1 algorithm.
Author
Jan Luehe

Field Summary

Modifier and TypeField and Description
private int
private SecureRandom

Constructor Summary

AccessConstructor and Description
public
HmacSHA1KeyGenerator()

Empty constructor

Method Summary

Modifier and TypeMethod and Description
protected SecretKey

Returns:

the new HMAC-SHA1 key
engineGenerateKey
()

Implements abstract javax.crypto.KeyGeneratorSpi.engineGenerateKey.

Generates an HMAC-SHA1 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

HmacSHA1KeyGeneratorback to summary
public HmacSHA1KeyGenerator()

Empty constructor

Method Detail

engineGenerateKeyback to summary
protected SecretKey engineGenerateKey()

Implements abstract javax.crypto.KeyGeneratorSpi.engineGenerateKey.

Generates an HMAC-SHA1 key.

Returns:SecretKey

the new HMAC-SHA1 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