Cumulus4j API
(1.0.1)

org.cumulus4j.crypto.internal.mac
Class MACCalculatorImpl

java.lang.Object
  extended by org.cumulus4j.crypto.internal.mac.MACCalculatorImpl
All Implemented Interfaces:
Mac, MACCalculator

public class MACCalculatorImpl
extends Object
implements MACCalculator

Author:
Marco หงุ่ยตระกูล-Schulze - marco at nightlabs dot de

Constructor Summary
MACCalculatorImpl(Mac macEngine, int keySize, int ivSize)
           
 
Method Summary
 byte[] doFinal(byte[] in)
          Convenience method to process the complete input byte array at once.
 int doFinal(byte[] out, int outOff)
           
 String getAlgorithmName()
           
 int getIVSize()
          Get the required size of the IV (in bytes).
 int getKeySize()
          Get the required size of the key (in bytes).
 int getMacSize()
           
 CipherParameters getParameters()
           
 void init(CipherParameters params)
           
 void reset()
           
 void setAlgorithmName(String algorithmName)
           
 void update(byte in)
           
 void update(byte[] in, int inOff, int len)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MACCalculatorImpl

public MACCalculatorImpl(Mac macEngine,
                         int keySize,
                         int ivSize)
Method Detail

init

public void init(CipherParameters params)
          throws IllegalArgumentException
Specified by:
init in interface Mac
Throws:
IllegalArgumentException

getParameters

public CipherParameters getParameters()
Specified by:
getParameters in interface MACCalculator

getKeySize

public int getKeySize()
Description copied from interface: MACCalculator
Get the required size of the key (in bytes).

Specified by:
getKeySize in interface MACCalculator
Returns:
the required size of the key (in bytes).

getIVSize

public int getIVSize()
Description copied from interface: MACCalculator
Get the required size of the IV (in bytes). If a MAC supports multiple sizes, this is the optimal (most secure) IV size. If a MAC supports no IV, this is 0.

Specified by:
getIVSize in interface MACCalculator
Returns:
the required size of the IV.

setAlgorithmName

public void setAlgorithmName(String algorithmName)
Specified by:
setAlgorithmName in interface MACCalculator

getAlgorithmName

public String getAlgorithmName()
Specified by:
getAlgorithmName in interface Mac

getMacSize

public int getMacSize()
Specified by:
getMacSize in interface Mac

update

public void update(byte in)
            throws IllegalStateException
Specified by:
update in interface Mac
Throws:
IllegalStateException

update

public void update(byte[] in,
                   int inOff,
                   int len)
            throws DataLengthException,
                   IllegalStateException
Specified by:
update in interface Mac
Throws:
DataLengthException
IllegalStateException

doFinal

public int doFinal(byte[] out,
                   int outOff)
            throws DataLengthException,
                   IllegalStateException
Specified by:
doFinal in interface Mac
Throws:
DataLengthException
IllegalStateException

doFinal

public byte[] doFinal(byte[] in)
               throws IllegalStateException
Description copied from interface: MACCalculator
Convenience method to process the complete input byte array at once.

Specified by:
doFinal in interface MACCalculator
Parameters:
in - the input to calculate a MAC for.
Returns:
the MAC.
Throws:
IllegalStateException - if the MACCalculator isn't initialised.

reset

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

Cumulus4j API
(1.0.1)

Copyright © 2012 NightLabs Consulting GmbH. All Rights Reserved.