public class Rakp1 extends IpmiCommandCoder<Rakp1ResponseData>

A wrapper for RMCP+ RAKP1 message and it's response - RAKP2 message. The same instance of this class that was used to prepare RAKP Message 1 should be also used to decode matching RAKP Message 2 since the generated random number is used in encryption process.

Capable of calculating SIK (Session Integrity Key) when RAKP Message 2 is given (calculateSik(Rakp1ResponseData)).

  • Constructor Details

    • Rakp1

      public Rakp1(int managedSystemSessionId, PrivilegeLevel privilegeLevel, String username, byte[] password, byte[] bmcKey, CipherSuite cipherSuite)
      Initiates class for encoding and decoding. Sets IPMI version to IpmiVersion.V20 since RAKP1 is a RMCP+ command. Sets Authentication Type to RMCP+.
      Parameters:
      managedSystemSessionId - - The Managed System's Session ID for this session. Must be as returned by the Managed System in the Open Session Response message.
      privilegeLevel - - Requested Maximum PrivilegeLevel
      username - - ASCII character Name that the user at the Remote Console wishes to assume for this session. It's length cannot exceed 16.
      password - - password matching username, as sent to the BMC (UTF-8 for a text password), at most 20 bytes
      bmcKey - - BMC specific key. Should be null if Get Channel Authentication Capabilities Response indicated that Kg is disabled which means that 'one-key' logins are being used ( GetChannelAuthenticationCapabilitiesResponseData.isKgEnabled() == false)
      cipherSuite - - CipherSuite containing authentication, confidentiality and integrity algorithms for this session.
  • Method Details

    • setManagedSystemSessionId

      public void setManagedSystemSessionId(int managedSystemSessionId)
    • getManagedSystemSessionId

      public int getManagedSystemSessionId()
    • setRequestedMaximumPrivilegeLevel

      public void setRequestedMaximumPrivilegeLevel(PrivilegeLevel requestedMaximumPrivilegeLevel)
    • getRequestedMaximumPrivilegeLevel

      public PrivilegeLevel getRequestedMaximumPrivilegeLevel()
    • setUsername

      public void setUsername(String username)
    • checkCredentials

      public static void checkCredentials(String username, byte[] password, byte[] bmcKey)
      Checks the credentials of a session against what a BMC stores: a user name of at most 16 bytes in UTF-8, a password and a BMC key (Kg) of at most 20 bytes.
      Parameters:
      username - the user name
      password - the password as sent to the BMC, or null
      bmcKey - the BMC key, or null
      Throws:
      IllegalArgumentException - when one of them is too long
    • getUsername

      public String getUsername()
    • getConsoleRandomNumber

      public byte[] getConsoleRandomNumber()
    • getBmcKey

      public byte[] getBmcKey()
    • encodePayload

      public IpmiMessage encodePayload(int messageSequenceNumber, int sessionSequenceNumber, int sessionId)
      Description copied from class: PayloadCoder
      Prepares an IPMI request message containing class-specific payload.
      Overrides:
      encodePayload in class PayloadCoder
      Parameters:
      messageSequenceNumber - - A generated sequence number used for matching request and response. For all IPMI messages, messageSequenceNumber is used as a IPMI LAN Message sequence number and as an IPMI payload message tag.
      sessionSequenceNumber - - If IPMI message is sent in a session, it is used as a Session Sequence Number
      sessionId - - ID of the managed system's session message is being sent in. For sessionless commands should b set to 0.
      Returns:
      IPMI message
    • getCommandCode

      public byte getCommandCode()
      Description copied from class: IpmiCommandCoder
      Retrieves command code specific for command represented by this class
      Specified by:
      getCommandCode in class IpmiCommandCoder<Rakp1ResponseData>
      Returns:
      command code
    • getNetworkFunction

      public NetworkFunction getNetworkFunction()
      Description copied from class: IpmiCommandCoder
      Retrieves network function specific for command represented by this class.
      Specified by:
      getNetworkFunction in class IpmiCommandCoder<Rakp1ResponseData>
      Returns:
      network function, or null for a command of a network function NetworkFunction does not list, which overrides IpmiCommandCoder.getNetworkFunctionCode() instead
      See Also:
    • getResponseData

      Description copied from class: PayloadCoder
      Retrieves payload-specific response data from IPMI message
      Specified by:
      getResponseData in class IpmiCommandCoder<Rakp1ResponseData>
      Parameters:
      message - - IPMI message
      Returns:
      response data
      Throws:
      IllegalArgumentException - when message is not a response for class-specific command, response has invalid length or authentication check fails.
      NoSuchAlgorithmException - - when authentication, confidentiality or integrity algorithm fails.
      InvalidKeyException - - when creating of the algorithm key fails
      IPMIException - when response completion code isn't OK.
    • calculateSik

      public byte[] calculateSik(Rakp1ResponseData responseData) throws InvalidKeyException, NoSuchAlgorithmException
      Calculates SIK (Session Integrity Key) based on RAKP Messages 1 and 2
      Parameters:
      responseData - RAKP Message 2 data
      Returns:
      Session Integrity Key
      Throws:
      NoSuchAlgorithmException - - when authentication, confidentiality or integrity algorithm fails.
      InvalidKeyException - - when creating of the algorithm key fails
    • isCommandResponse

      public boolean isCommandResponse(IpmiMessage message)
      Description copied from class: IpmiCommandCoder
      Checks if given message contains response command specific for this class.
      Overrides:
      isCommandResponse in class IpmiCommandCoder<Rakp1ResponseData>
      Parameters:
      message - IpmiMessage wrapping the IPMI message
      Returns:
      True if message contains response command specific for this class, false otherwise.