gnu.crypto.mac

Class BaseMac

Implemented Interfaces:
Cloneable, IMac
Known Direct Subclasses:
HMac, TMMH16, UHash32, UMac32

public abstract class BaseMac
extends java.lang.Object
implements IMac

A base abstract class to facilitate MAC (Message Authentication Code) implementations.

Version:
$Revision: 1.4 $

Field Summary

protected String
name
The canonical name prefix of the MAC.
protected int
truncatedSize
The length of the truncated output in bytes.
protected IMessageDigest
underlyingHash
Reference to the underlying hash algorithm instance.

Fields inherited from interface gnu.crypto.mac.IMac

MAC_KEY_MATERIAL, TRUNCATED_SIZE

Constructor Summary

BaseMac(String name)
Trivial constructor for use by concrete subclasses.
BaseMac(String name, IMessageDigest underlyingHash)
Trivial constructor for use by concrete subclasses.

Method Summary

Object
clone()
byte[]
digest()
void
init(Map attributes)
int
macSize()
String
name()
void
reset()
boolean
selfTest()
void
update(byte b)
void
update(byte[] b, int offset, int len)

Field Details

name

protected String name
The canonical name prefix of the MAC.


truncatedSize

protected int truncatedSize
The length of the truncated output in bytes.


underlyingHash

protected IMessageDigest underlyingHash
Reference to the underlying hash algorithm instance.

Constructor Details

BaseMac

protected BaseMac(String name)
Trivial constructor for use by concrete subclasses.

Parameters:
name - the canonical name of this instance.


BaseMac

protected BaseMac(String name,
                  IMessageDigest underlyingHash)
Trivial constructor for use by concrete subclasses.

Parameters:
name - the canonical name of this instance.
underlyingHash - the underlying message digest algorithm instance.

Method Details

clone

public Object clone()
Specified by:
clone in interface IMac


digest

public byte[] digest()
Specified by:
digest in interface IMac


init

public void init(Map attributes)
            throws InvalidKeyException,
                   IllegalStateException
Specified by:
init in interface IMac


macSize

public int macSize()
Specified by:
macSize in interface IMac


name

public String name()
Specified by:
name in interface IMac


reset

public void reset()
Specified by:
reset in interface IMac


selfTest

public boolean selfTest()
Specified by:
selfTest in interface IMac


update

public void update(byte b)
Specified by:
update in interface IMac


update

public void update(byte[] b,
                   int offset,
                   int len)
Specified by:
update in interface IMac


Copyright © 2001, 2002, 2003 Free Software Foundation, Inc. All Rights Reserved.