Class CMAC

java.lang.Object
org.apache.sshd.common.mac.CMAC
All Implemented Interfaces:
AlgorithmNameProvider, Mac, MacInformation

public class CMAC extends Object implements Mac
  • Field Details

    • engine

      private org.bouncycastle.crypto.engines.SM4Engine engine
    • mac

      private org.bouncycastle.crypto.macs.CBCBlockCipherMac mac
    • params

      private org.bouncycastle.crypto.CipherParameters params
    • KEY_LENGTH

      private static final int KEY_LENGTH
      See Also:
    • initkey

      private byte[] initkey
    • iv

      private byte[] iv
  • Constructor Details

    • CMAC

      public CMAC()
  • Method Details

    • init

      public void init(byte[] key) throws Exception
      Specified by:
      init in interface Mac
      Throws:
      Exception
    • update

      public void update(byte[] buf, int start, int len)
      Specified by:
      update in interface Mac
    • updateUInt

      public void updateUInt(long foo)
      Specified by:
      updateUInt in interface Mac
    • doFinal

      public void doFinal(byte[] buf, int offset) throws Exception
      Specified by:
      doFinal in interface Mac
      Throws:
      Exception
    • getBlockSize

      public int getBlockSize()
      Specified by:
      getBlockSize in interface MacInformation
      Returns:
      MAC output block size in bytes - may be less than the default - e.g., MD5-96
    • getDefaultBlockSize

      public int getDefaultBlockSize()
      Specified by:
      getDefaultBlockSize in interface MacInformation
      Returns:
      The "natural" MAC block size in bytes
    • getAlgorithm

      public String getAlgorithm()
      Specified by:
      getAlgorithm in interface AlgorithmNameProvider