Class AbstractHmac

java.lang.Object
com.sshtools.common.ssh.components.jce.AbstractHmac
All Implemented Interfaces:
Component, SshComponent, SshHmac, SecureComponent
Direct Known Subclasses:
HmacMD5, HmacMD596, HmacMD5ETM, HmacRipeMd160, HmacRipeMd160ETM, HmacSha1, HmacSha196, HmacSha1ETM, HmacSha256, HmacSha256_at_ssh_dot_com, HmacSha256ETM, HmacSha512, HmacSha512ETM

public abstract class AbstractHmac extends Object implements SshHmac
An abstract class that implements the SshHmac interface to provide support for JCE based message authentication.
Author:
Lee David Painter
  • Field Details

    • mac

      protected Mac mac
    • macSize

      protected int macSize
    • macLength

      protected int macLength
    • jceAlgorithm

      protected String jceAlgorithm
  • Constructor Details

    • AbstractHmac

      public AbstractHmac(String jceAlgorithm, int macLength, SecurityLevel securityLevel, int priority)
    • AbstractHmac

      public AbstractHmac(String jceAlgorithm, int macSize, int outputLength, SecurityLevel securityLevel, int priority)
  • Method Details

    • getSecurityLevel

      public SecurityLevel getSecurityLevel()
      Specified by:
      getSecurityLevel in interface SecureComponent
    • getPriority

      public int getPriority()
      Specified by:
      getPriority in interface SecureComponent
    • generate

      public void generate(long sequenceNo, byte[] data, int offset, int len, byte[] output, int start)
      Specified by:
      generate in interface SshHmac
    • update

      public void update(byte[] b)
      Specified by:
      update in interface SshHmac
    • doFinal

      public byte[] doFinal()
      Specified by:
      doFinal in interface SshHmac
    • getAlgorithm

      public abstract String getAlgorithm()
      Specified by:
      getAlgorithm in interface SecureComponent
      Specified by:
      getAlgorithm in interface SshComponent
      Specified by:
      getAlgorithm in interface SshHmac
    • getProvider

      public String getProvider()
    • getMacSize

      public int getMacSize()
      Description copied from interface: SshHmac
      The size of the message digest output by the hmac algorithm
      Specified by:
      getMacSize in interface SshHmac
      Returns:
    • getMacLength

      public int getMacLength()
      Description copied from interface: SshHmac
      The length of the message digest output by this implementation (maybe lower than mac size);
      Specified by:
      getMacLength in interface SshHmac
      Returns:
    • isETM

      public boolean isETM()
      Specified by:
      isETM in interface SshHmac
    • init

      public void init(byte[] keydata) throws SshException
      Specified by:
      init in interface SshHmac
      Throws:
      SshException
    • verify

      public boolean verify(long sequenceNo, byte[] data, int start, int len, byte[] mac, int offset)
      Specified by:
      verify in interface SshHmac