All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class au.net.aba.crypto.provider.DESMac

java.lang.Object
   |
   +----javax.crypto.MacSpi
           |
           +----au.net.aba.crypto.provider.DESMac

public class DESMac
extends MacSpi
This class implements the DES based MAC algorithm as defined in FIPS PUB 113.

This algorithm produces a 4 byte MAC value.

Currently this class will not work correctly unless the input data size is an exact multiple of 8. Data that isnt of this length should be padded with zeros. Eventually the DES cipher class will be modified to perform this function.


Constructor Index

 o DESMac()
Default constructor, initialises the instance.

Method Index

 o engineDoFinal()
Completes the MAC computation and resets the MAC for further use, maintaining the secret key that the MAC was initialised with.
 o engineGetMacLength()
Returns the length of the MAC in bytes.
 o engineInit(Key, AlgorithmParameterSpec)
Initialises the MAC with the given (secret) key and algorithm parameters.
 o engineReset()
Resets the MAC for further use, maintaining the secret key that the MAC was initialised with.
 o engineUpdate(byte)
Processes the given byte.
 o engineUpdate(byte[], int, int)
Processes the first len bytes in input, starting at offset.

Constructors

 o DESMac
 public DESMac()
Default constructor, initialises the instance.

Methods

 o engineGetMacLength
 protected int engineGetMacLength()
Returns the length of the MAC in bytes.

Returns:
the MAC length in bytes.
Overrides:
engineGetMacLength in class MacSpi
 o engineInit
 protected void engineInit(Key key,
                           AlgorithmParameterSpec params) throws InvalidKeyException, InvalidAlgorithmParameterException
Initialises the MAC with the given (secret) key and algorithm parameters. The key parameter should be a type that is compatible with the DES Cipher.

Parameters:
key - the (secret) key.
params - the algorithm parameters.
Throws: InvalidKeyException
if the given key is inappropriate for initialising this MAC.
Throws: InvalidAlgorithmParameterException
if the given algorithm parameters are inappropriate for this MAC.
Overrides:
engineInit in class MacSpi
 o engineUpdate
 protected void engineUpdate(byte input)
Processes the given byte.

Parameters:
input - the input byte to be processed.
Overrides:
engineUpdate in class MacSpi
 o engineUpdate
 protected void engineUpdate(byte input[],
                             int offset,
                             int len)
Processes the first len bytes in input, starting at offset.

Parameters:
input - the input buffer.
offset - the offset in input where the input starts.
len - the number of bytes to process.
Overrides:
engineUpdate in class MacSpi
 o engineDoFinal
 protected byte[] engineDoFinal()
Completes the MAC computation and resets the MAC for further use, maintaining the secret key that the MAC was initialised with.

Returns:
the MAC result.
Overrides:
engineDoFinal in class MacSpi
 o engineReset
 protected void engineReset()
Resets the MAC for further use, maintaining the secret key that the MAC was initialised with.

Overrides:
engineReset in class MacSpi

All Packages  Class Hierarchy  This Package  Previous  Next  Index