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[]byteRetrieves command code specific for command represented by this classbyte[]intRetrieves network function specific for command represented by this class.getResponseData(IpmiMessage message) Retrieves payload-specific response data from IPMI messagebooleanisCommandResponse(IpmiMessage message) Checks if given message contains response command specific for this class.voidsetManagedSystemSessionId(int managedSystemSessionId) voidsetRequestedMaximumPrivilegeLevel(PrivilegeLevel requestedMaximumPrivilegeLevel) voidsetUsername(String username) Methods inherited from class org.metricshub.ipmi.core.coding.commands.IpmiCommandCoder
getSupportedPayloadTypeMethods 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.V20since 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 MaximumPrivilegeLevelusername- - 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- -CipherSuitecontaining 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:PayloadCoderPrepares an IPMI request message containing class-specific payload.- Overrides:
encodePayloadin 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:IpmiCommandCoderRetrieves command code specific for command represented by this class- Specified by:
getCommandCodein classIpmiCommandCoder- Returns:
- command code
-
getNetworkFunction
Description copied from class:IpmiCommandCoderRetrieves network function specific for command represented by this class.- Specified by:
getNetworkFunctionin classIpmiCommandCoder- Returns:
- network function
- See Also:
-
getResponseData
public ResponseData getResponseData(IpmiMessage message) throws IPMIException, NoSuchAlgorithmException, InvalidKeyException Description copied from class:PayloadCoderRetrieves payload-specific response data from IPMI message- Specified by:
getResponseDatain 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:IpmiCommandCoderChecks if given message contains response command specific for this class.- Overrides:
isCommandResponsein classIpmiCommandCoder- Parameters:
message-IpmiMessagewrapping the IPMI message- Returns:
- True if message contains response command specific for this class, false otherwise.
-