• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2006-2011 Christian Plattner. All rights reserved.
3  * Please refer to the LICENSE.txt for licensing details.
4  */
5 package ch.ethz.ssh2.packets;
6 
7 import java.io.IOException;
8 
9 import java.math.BigInteger;
10 
11 /**
12  * PacketKexDHReply.
13  *
14  * @author Christian Plattner
15  * @version 2.50, 03/15/10
16  */
17 public class PacketKexDHReply
18 {
19 	byte[] payload;
20 
21 	byte[] hostKey;
22 	BigInteger f;
23 	byte[] signature;
24 
PacketKexDHReply(byte payload[], int off, int len)25 	public PacketKexDHReply(byte payload[], int off, int len) throws IOException
26 	{
27 		this.payload = new byte[len];
28 		System.arraycopy(payload, off, this.payload, 0, len);
29 
30 		TypesReader tr = new TypesReader(payload, off, len);
31 
32 		int packet_type = tr.readByte();
33 
34 		if (packet_type != Packets.SSH_MSG_KEXDH_REPLY)
35 			throw new IOException("This is not a SSH_MSG_KEXDH_REPLY! ("
36 					+ packet_type + ")");
37 
38 		hostKey = tr.readByteString();
39 		f = tr.readMPINT();
40 		signature = tr.readByteString();
41 
42 		if (tr.remain() != 0) throw new IOException("PADDING IN SSH_MSG_KEXDH_REPLY!");
43 	}
44 
getF()45 	public BigInteger getF()
46 	{
47 		return f;
48 	}
49 
getHostKey()50 	public byte[] getHostKey()
51 	{
52 		return hostKey;
53 	}
54 
getSignature()55 	public byte[] getSignature()
56 	{
57 		return signature;
58 	}
59 }
60