1 package org.metricshub.ipmi.core.sm.events;
2
3 /*-
4 * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲
5 * IPMI Java Client
6 * ჻჻჻჻჻჻
7 * Copyright 2023 Verax Systems, MetricsHub
8 * ჻჻჻჻჻჻
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Lesser General Public License as
11 * published by the Free Software Foundation, either version 3 of the
12 * License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Lesser Public License for more details.
18 *
19 * You should have received a copy of the GNU General Lesser Public
20 * License along with this program. If not, see
21 * <http://www.gnu.org/licenses/lgpl-3.0.html>.
22 * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱
23 */
24
25 import org.metricshub.ipmi.core.coding.commands.PrivilegeLevel;
26 import org.metricshub.ipmi.core.coding.commands.session.GetChannelAuthenticationCapabilitiesResponseData;
27 import org.metricshub.ipmi.core.coding.security.CipherSuite;
28 import org.metricshub.ipmi.core.sm.StateMachine;
29 import org.metricshub.ipmi.core.sm.states.OpenSessionComplete;
30 import org.metricshub.ipmi.core.sm.states.Rakp1Waiting;
31
32 /**
33 * Performs transition from {@link OpenSessionComplete} to {@link Rakp1Waiting}.
34 *
35 * @see StateMachine
36 */
37 public class OpenSessionAck extends Default {
38
39 private int managedSystemSessionId;
40 private String username;
41 private String password;
42 private byte[] bmcKey;
43
44 /**
45 * Provides data required to send RAKP Message 1.
46 *
47 * @param cipherSuite
48 * - {@link CipherSuite} containing authentication,
49 * confidentiality and integrity algorithms for this session.
50 * @param sequenceNumber
51 * - a sequence number for the message
52 * @param managedSystemSessionId
53 * - The Managed System's Session ID for this session. Must be as
54 * returned by the Managed System in the Open Session Response
55 * message.
56 * @param privilegeLevel
57 * - Requested Maximum {@link PrivilegeLevel}
58 * @param username
59 * - ASCII character Name that the user at the Remote Console
60 * wishes to assume for this session. It's length cannot exceed
61 * 16.
62 * @param password
63 * - password matching username
64 * @param bmcKey
65 * - BMC specific key. Should be null if Get Channel
66 * Authentication Capabilities Response indicated that Kg is
67 * disabled which means that 'one-key' logins are being used (
68 * {@link GetChannelAuthenticationCapabilitiesResponseData#isKgEnabled()}
69 * == false)
70 */
71 public OpenSessionAck(CipherSuite cipherSuite,
72 PrivilegeLevel privilegeLevel, int sequenceNumber,
73 int managedSystemSessionId, String username, String password,
74 byte[] bmcKey) {
75 super(cipherSuite, sequenceNumber, privilegeLevel);
76 this.managedSystemSessionId = managedSystemSessionId;
77 this.username = username;
78 this.password = password;
79 this.bmcKey = bmcKey;
80 }
81
82 public int getManagedSystemSessionId() {
83 return managedSystemSessionId;
84 }
85
86 public String getUsername() {
87 return username;
88 }
89
90 public String getPassword() {
91 return password;
92 }
93
94 public byte[] getBmcKey() {
95 return bmcKey;
96 }
97 }