public class Rakp1 extends IpmiCommandCoder
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 and Description |
---|
Rakp1(int managedSystemSessionId,
PrivilegeLevel privilegeLevel,
java.lang.String username,
java.lang.String password,
byte[] bmcKey,
CipherSuite cipherSuite)
Initiates class for encoding and decoding.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
calculateSik(Rakp1ResponseData responseData)
Calculates SIK (Session Integrity Key) based on RAKP Messages 1 and 2
|
IpmiMessage |
encodeCommand(int sequenceNumber,
int sessionId)
Prepares an IPMI request message containing class-specific command
|
byte[] |
getBmcKey() |
byte |
getCommandCode()
Deprecated.
|
byte[] |
getConsoleRandomNumber() |
int |
getManagedSystemSessionId() |
NetworkFunction |
getNetworkFunction()
Deprecated.
|
java.lang.String |
getPassword() |
PrivilegeLevel |
getRequestedMaximumPrivilegeLevel() |
ResponseData |
getResponseData(IpmiMessage message)
Retrieves command-specific response data from IPMI message
|
java.lang.String |
getUsername() |
boolean |
isCommandResponse(IpmiMessage message)
Checks if given message contains response command specific for this
class.
|
void |
setManagedSystemSessionId(int managedSystemSessionId) |
void |
setRequestedMaximumPrivilegeLevel(PrivilegeLevel requestedMaximumPrivilegeLevel) |
void |
setUsername(java.lang.String username) |
getAuthenticationType, getCipherSuite, getIpmiVersion, setAuthenticationType, setCipherSuite, setIpmiVersion, setSessionParameters
public Rakp1(int managedSystemSessionId, PrivilegeLevel privilegeLevel, java.lang.String username, java.lang.String password, byte[] bmcKey, CipherSuite cipherSuite)
IpmiVersion.V20
since RAKP1 is a RMCP+ command. Sets
Authentication Type to RMCP+.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 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.public void setManagedSystemSessionId(int managedSystemSessionId)
public int getManagedSystemSessionId()
public void setRequestedMaximumPrivilegeLevel(PrivilegeLevel requestedMaximumPrivilegeLevel)
public PrivilegeLevel getRequestedMaximumPrivilegeLevel()
public void setUsername(java.lang.String username)
public java.lang.String getUsername()
public java.lang.String getPassword()
public byte[] getConsoleRandomNumber()
public byte[] getBmcKey()
public IpmiMessage encodeCommand(int sequenceNumber, int sessionId)
IpmiCommandCoder
encodeCommand
in class IpmiCommandCoder
sequenceNumber
- - A generated sequence number used for matching request and
response. If IPMI message is sent in a session, it is used as
a Session Sequence Number. For all IPMI messages,
sequenceNumber % 256 is used as a IPMI LAN Message sequence
number and as an IPMI payload message tag.sessionId
- - ID of the managed system's session message is being sent in.
For sessionless commands should b set to 0.@Deprecated public byte getCommandCode()
IpmiCommandCoder
getCommandCode
in class IpmiCommandCoder
@Deprecated public NetworkFunction getNetworkFunction()
IpmiCommandCoder
getNetworkFunction
in class IpmiCommandCoder
NetworkFunction
public ResponseData getResponseData(IpmiMessage message) throws java.lang.IllegalArgumentException, IPMIException, java.security.NoSuchAlgorithmException, java.security.InvalidKeyException
IpmiCommandCoder
getResponseData
in class IpmiCommandCoder
message
- - IPMI messagejava.lang.IllegalArgumentException
- when message is not a response for class-specific command,
response has invalid length or authentication check fails.java.security.NoSuchAlgorithmException
- - when authentication, confidentiality or integrity algorithm
fails.java.security.InvalidKeyException
- - when creating of the algorithm key failsIPMIException
- when response completion code isn't OK.public byte[] calculateSik(Rakp1ResponseData responseData) throws java.security.InvalidKeyException, java.security.NoSuchAlgorithmException
responseData
- RAKP Message 2 datajava.security.NoSuchAlgorithmException
- - when authentication, confidentiality or integrity algorithm
fails.java.security.InvalidKeyException
- - when creating of the algorithm key failspublic boolean isCommandResponse(IpmiMessage message)
IpmiCommandCoder
isCommandResponse
in class IpmiCommandCoder