1/*
2 * Copyright (c) 2006-2011 Christian Plattner. All rights reserved.
3 * Please refer to the LICENSE.txt for licensing details.
4 */
5package ch.ethz.ssh2.packets;
6
7/**
8 * PacketUserauthRequestInteractive.
9 *
10 * @author Christian Plattner
11 * @version 2.50, 03/15/10
12 */
13public class PacketUserauthRequestInteractive
14{
15	byte[] payload;
16
17	String userName;
18	String serviceName;
19	String[] submethods;
20
21	public PacketUserauthRequestInteractive(String serviceName, String user, String[] submethods)
22	{
23		this.serviceName = serviceName;
24		this.userName = user;
25		this.submethods = submethods;
26	}
27
28	public byte[] getPayload()
29	{
30		if (payload == null)
31		{
32			TypesWriter tw = new TypesWriter();
33			tw.writeByte(Packets.SSH_MSG_USERAUTH_REQUEST);
34			tw.writeString(userName);
35			tw.writeString(serviceName);
36			tw.writeString("keyboard-interactive");
37			tw.writeString(""); // draft-ietf-secsh-newmodes-04.txt says that
38			// the language tag should be empty.
39			tw.writeNameList(submethods);
40
41			payload = tw.getBytes();
42		}
43		return payload;
44	}
45}
46