de.flexiprovider.core.mac
Class HMacKeyGenerator

java.lang.Object
  |
  +--javax.crypto.KeyGeneratorSpi
        |
        +--de.flexiprovider.api.keys.SecretKeyGenerator
              |
              +--de.flexiprovider.core.mac.HMacKeyGenerator
Direct Known Subclasses:
HMacKeyGenerator.DHA256, HMacKeyGenerator.FORK256, HMacKeyGenerator.MD4, HMacKeyGenerator.MD5, HMacKeyGenerator.RIPEMD128, HMacKeyGenerator.RIPEMD160, HMacKeyGenerator.RIPEMD256, HMacKeyGenerator.RIPEMD320, HMacKeyGenerator.SHA1, HMacKeyGenerator.SHA224, HMacKeyGenerator.SHA256, HMacKeyGenerator.SHA384, HMacKeyGenerator.SHA512, HMacKeyGenerator.Tiger

public class HMacKeyGenerator
extends SecretKeyGenerator


Inner Class Summary
static class HMacKeyGenerator.DHA256
           
static class HMacKeyGenerator.FORK256
           
static class HMacKeyGenerator.MD4
           
static class HMacKeyGenerator.MD5
           
static class HMacKeyGenerator.RIPEMD128
           
static class HMacKeyGenerator.RIPEMD160
           
static class HMacKeyGenerator.RIPEMD256
           
static class HMacKeyGenerator.RIPEMD320
           
static class HMacKeyGenerator.SHA1
           
static class HMacKeyGenerator.SHA224
           
static class HMacKeyGenerator.SHA256
           
static class HMacKeyGenerator.SHA384
           
static class HMacKeyGenerator.SHA512
           
static class HMacKeyGenerator.Tiger
           
 
Constructor Summary
protected HMacKeyGenerator(int keySize)
          Constructor.
 
Method Summary
 SecretKey generateKey()
          Generate an HMac key.
 void init(AlgorithmParameterSpec params, SecureRandom random)
          Initialize the key generator.
 void init(int keySize, SecureRandom random)
          Initialize the key generator.
 void init(SecureRandom random)
          Initialize the key generator with a source of randomness.
 
Methods inherited from class de.flexiprovider.api.keys.SecretKeyGenerator
engineGenerateKey, engineInit, engineInit, engineInit, init, init, init
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HMacKeyGenerator

protected HMacKeyGenerator(int keySize)
Constructor. Set the key size.
Parameters:
keySize - the key size in bits
Method Detail

init

public void init(AlgorithmParameterSpec params,
                 SecureRandom random)
Initialize the key generator. Since the key size is set by the concrete instantiations and no further parameters are used, the parameters are ignored and only the source of randomness is set.
Overrides:
init in class SecretKeyGenerator
Parameters:
params - the parameters (not used)
random - the source of randomness

init

public void init(int keySize,
                 SecureRandom random)
Initialize the key generator. Since the key size is set by the concrete instantiations, the key size parameter is ignored and only the source of randomness is set.
Overrides:
init in class SecretKeyGenerator
Parameters:
keySize - the key size (not used)
random - the source of randomness

init

public void init(SecureRandom random)
Initialize the key generator with a source of randomness.
Overrides:
init in class SecretKeyGenerator
Parameters:
random - the source of randomness

generateKey

public SecretKey generateKey()
Generate an HMac key.
Overrides:
generateKey in class SecretKeyGenerator
Returns:
the generated HMacKey