comparison src/com/trilead/ssh2/packets/PacketKexDhGexReply.java @ 0:0ce5cc452d02

initial version
author Carl Byington <carl@five-ten-sg.com>
date Thu, 22 May 2014 10:41:19 -0700
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:0ce5cc452d02
1
2 package com.trilead.ssh2.packets;
3
4 import java.io.IOException;
5
6 import java.math.BigInteger;
7
8 /**
9 * PacketKexDhGexReply.
10 *
11 * @author Christian Plattner, plattner@trilead.com
12 * @version $Id: PacketKexDhGexReply.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $
13 */
14 public class PacketKexDhGexReply {
15 byte[] payload;
16
17 byte[] hostKey;
18 BigInteger f;
19 byte[] signature;
20
21 public PacketKexDhGexReply(byte payload[], int off, int len) throws IOException {
22 this.payload = new byte[len];
23 System.arraycopy(payload, off, this.payload, 0, len);
24 TypesReader tr = new TypesReader(payload, off, len);
25 int packet_type = tr.readByte();
26
27 if (packet_type != Packets.SSH_MSG_KEX_DH_GEX_REPLY)
28 throw new IOException("This is not a SSH_MSG_KEX_DH_GEX_REPLY! (" + packet_type + ")");
29
30 hostKey = tr.readByteString();
31 f = tr.readMPINT();
32 signature = tr.readByteString();
33
34 if (tr.remain() != 0)
35 throw new IOException("PADDING IN SSH_MSG_KEX_DH_GEX_REPLY!");
36 }
37
38 public BigInteger getF() {
39 return f;
40 }
41
42 public byte[] getHostKey() {
43 return hostKey;
44 }
45
46 public byte[] getSignature() {
47 return signature;
48 }
49 }