Class AuthenticationAlgorithm

java.lang.Object
org.metricshub.ipmi.core.coding.security.AuthenticationAlgorithm
Direct Known Subclasses:
AuthenticationRakpHmacMd5, AuthenticationRakpHmacSha1, AuthenticationRakpHmacSha256, AuthenticationRakpNone

public abstract class AuthenticationAlgorithm extends Object
Interface for authentication algorithms. All classes extending this one must have a parameterless constructor.
  • Method Details

    • getCode

      public abstract byte getCode()
      Returns:
      algorithm-specific code
    • getKeyLength

      public abstract int getKeyLength()
      Returns:
      length of the key for the RAKP2 message
    • getIntegrityCheckBaseLength

      public abstract int getIntegrityCheckBaseLength()
      Returns:
      length of the integrity check base for RAKP4 message
    • checkKeyExchangeAuthenticationCode

      public boolean checkKeyExchangeAuthenticationCode(byte[] data, byte[] key, String password) throws NoSuchAlgorithmException, InvalidKeyException
      Checks value of the Key Exchange Authentication Code in RAKP messages
      Parameters:
      data - - The base for authentication algorithm. Depends on RAKP Message.
      key - - the Key Exchange Authentication Code to check.
      password - - password of the user establishing a session
      Returns:
      True if authentication check was successful, false otherwise.
      Throws:
      NoSuchAlgorithmException - when initiation of the algorithm fails
      InvalidKeyException - when creating of the algorithm key fails
    • getKeyExchangeAuthenticationCode

      public byte[] getKeyExchangeAuthenticationCode(byte[] data, String password) throws NoSuchAlgorithmException, InvalidKeyException
      Calculates value of the Key Exchange Authentication Code in RAKP messages
      Parameters:
      data - - The base for authentication algorithm. Depends on RAKP Message.
      password - - password of the user establishing a session
      Throws:
      NoSuchAlgorithmException - when initiation of the algorithm fails
      InvalidKeyException - when creating of the algorithm key fails
    • doIntegrityCheck

      public boolean doIntegrityCheck(byte[] data, byte[] reference, byte[] sik) throws InvalidKeyException, NoSuchAlgorithmException
      Validates Integrity Check Value in RAKP Message 4.
      Parameters:
      data - - The base for authentication algorithm.
      reference - - The Integrity Check Value to validate.
      sik - - The Session Integrity Key generated on base of RAKP Messages 1 and 2.
      Returns:
      True if integrity check was successful, false otherwise.
      Throws:
      NoSuchAlgorithmException - when initiation of the algorithm fails
      InvalidKeyException - when creating of the algorithm key fails
      See Also:
    • getAlgorithmName

      public abstract String getAlgorithmName()
      Returns:
      the name of the algorithm as a String.