Class FipsOutputMACCalculator<T>

  • Type Parameters:
    T - the parameters type associated with the final implementation of this calculator.
    All Implemented Interfaces:
    OutputMACCalculator<T>

    public abstract class FipsOutputMACCalculator<T>
    extends java.lang.Object
    implements OutputMACCalculator<T>
    Base class for the approved mode OutputMACCalculator implementations.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] getMAC()
      Return the MAC calculated on what has been written to the calculator's output stream.
      abstract int getMAC​(byte[] output, int off)
      Output the current MAC value for what has been written to the calculator's output stream.
      abstract int getMACSize()
      Return the size of the MAC produced by this calculator in bytes.
      abstract UpdateOutputStream getMACStream()
      Returns a stream that will accept data for the purpose of calculating a MAC.
      abstract T getParameters()
      Return the parameters for this MAC calculator.
      abstract void reset()
      Reset the calculator back to its initial state.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getMAC

        public byte[] getMAC()
        Description copied from interface: OutputMACCalculator
        Return the MAC calculated on what has been written to the calculator's output stream.
        Specified by:
        getMAC in interface OutputMACCalculator<T>
        Returns:
        a MAC.
      • getMACSize

        public abstract int getMACSize()
        Description copied from interface: OutputMACCalculator
        Return the size of the MAC produced by this calculator in bytes.
        Specified by:
        getMACSize in interface OutputMACCalculator<T>
        Returns:
        MAC length in bytes.
      • getMACStream

        public abstract UpdateOutputStream getMACStream()
        Description copied from interface: OutputMACCalculator
        Returns a stream that will accept data for the purpose of calculating a MAC. Use org.bouncycastle.util.io.TeeOutputStream if you want to accumulate the data on the fly as well.
        Specified by:
        getMACStream in interface OutputMACCalculator<T>
        Returns:
        an UpdateOutputStream
      • getMAC

        public abstract int getMAC​(byte[] output,
                                   int off)
        Description copied from interface: OutputMACCalculator
        Output the current MAC value for what has been written to the calculator's output stream.
        Specified by:
        getMAC in interface OutputMACCalculator<T>
        Parameters:
        output - output array to write the MAC to.
        off - offset to start writing the MAC at.
        Returns:
        the number of bytes written