Class Rakp1
java.lang.Object
org.metricshub.ipmi.core.coding.PayloadCoder
org.metricshub.ipmi.core.coding.commands.IpmiCommandCoder
org.metricshub.ipmi.core.coding.commands.session.Rakp1
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 Summary
ConstructorsConstructorDescriptionRakp1
(int managedSystemSessionId, PrivilegeLevel privilegeLevel, String username, String password, byte[] bmcKey, CipherSuite cipherSuite) Initiates class for encoding and decoding. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
calculateSik
(Rakp1ResponseData responseData) Calculates SIK (Session Integrity Key) based on RAKP Messages 1 and 2encodePayload
(int messageSequenceNumber, int sessionSequenceNumber, int sessionId) Prepares an IPMI request message containing class-specific payload.byte[]
byte
Retrieves command code specific for command represented by this classbyte[]
int
Retrieves network function specific for command represented by this class.getResponseData
(IpmiMessage message) Retrieves payload-specific response data from IPMI messageboolean
isCommandResponse
(IpmiMessage message) Checks if given message contains response command specific for this class.void
setManagedSystemSessionId
(int managedSystemSessionId) void
setRequestedMaximumPrivilegeLevel
(PrivilegeLevel requestedMaximumPrivilegeLevel) void
setUsername
(String username) Methods inherited from class org.metricshub.ipmi.core.coding.commands.IpmiCommandCoder
getSupportedPayloadType
Methods inherited from class org.metricshub.ipmi.core.coding.PayloadCoder
getAuthenticationType, getCipherSuite, getIpmiVersion, setAuthenticationType, setCipherSuite, setIpmiVersion, setSessionParameters
-
Constructor Details
-
Rakp1
public Rakp1(int managedSystemSessionId, PrivilegeLevel privilegeLevel, String username, String password, byte[] bmcKey, CipherSuite cipherSuite) Initiates class for encoding and decoding. Sets IPMI version toIpmiVersion.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 MaximumPrivilegeLevel
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 usernamebmcKey
- - 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
-
getRequestedMaximumPrivilegeLevel
-
setUsername
-
getUsername
-
getPassword
-
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 classPayloadCoder
- 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 NumbersessionId
- - 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 classIpmiCommandCoder
- Returns:
- command code
-
getNetworkFunction
Description copied from class:IpmiCommandCoder
Retrieves network function specific for command represented by this class.- Specified by:
getNetworkFunction
in classIpmiCommandCoder
- Returns:
- network function
- See Also:
-
getResponseData
public ResponseData getResponseData(IpmiMessage message) throws IPMIException, NoSuchAlgorithmException, InvalidKeyException Description copied from class:PayloadCoder
Retrieves payload-specific response data from IPMI message- Specified by:
getResponseData
in classPayloadCoder
- 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 failsIPMIException
- 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
Description copied from class:IpmiCommandCoder
Checks if given message contains response command specific for this class.- Overrides:
isCommandResponse
in classIpmiCommandCoder
- Parameters:
message
-IpmiMessage
wrapping the IPMI message- Returns:
- True if message contains response command specific for this class, false otherwise.
-