de.flexiprovider.core.mac
Class TwoTrackMacKeyGenerator

java.lang.Object
  |
  +--javax.crypto.KeyGeneratorSpi
        |
        +--de.flexiprovider.api.keys.SecretKeyGenerator
              |
              +--de.flexiprovider.core.mac.TwoTrackMacKeyGenerator

public class TwoTrackMacKeyGenerator
extends SecretKeyGenerator

This class is used to generate keys for the Message Authentication Code TwoTrackMac. The TwoTrackMac key size is 20 bytes (160 bits).

Author:
Paul Nguentcheu

Field Summary
static int TTMAC_KEY_SIZE
          The TwoTrackMac key size (20 bytes)
 
Constructor Summary
TwoTrackMacKeyGenerator()
           
 
Method Summary
 SecretKey generateKey()
          Generate a TwoTrackMac 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
 

Field Detail

TTMAC_KEY_SIZE

public static final int TTMAC_KEY_SIZE
The TwoTrackMac key size (20 bytes)
Constructor Detail

TwoTrackMacKeyGenerator

public TwoTrackMacKeyGenerator()
Method Detail

init

public void init(AlgorithmParameterSpec params,
                 SecureRandom random)
Initialize the key generator. Since TwoTrackMac keys are of a fixed size and do not require any parameters, this method only sets the source of randomness.
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 TwoTrackMac keys are of a fixed size, this method only sets the source of randomness.
Overrides:
init in class SecretKeyGenerator
Parameters:
keySize - the key size (not used)
random - the source of randomness for this key generator

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 a TwoTrackMac key.
Overrides:
generateKey in class SecretKeyGenerator
Returns:
the generated TwoTrackMacKey