01: package ch.ethz.ssh2.packets;
02:
03: import java.io.IOException;
04:
05: import java.math.BigInteger;
06:
07: /**
08: * PacketKexDhGexReply.
09: *
10: * @author Christian Plattner, plattner@inf.ethz.ch
11: * @version $Id: PacketKexDhGexReply.java,v 1.2 2005/08/24 17:54:09 cplattne Exp $
12: */
13: public class PacketKexDhGexReply {
14: byte[] payload;
15:
16: byte[] hostKey;
17: BigInteger f;
18: byte[] signature;
19:
20: public PacketKexDhGexReply(byte payload[], int off, int len)
21: throws IOException {
22: this .payload = new byte[len];
23: System.arraycopy(payload, off, this .payload, 0, len);
24:
25: TypesReader tr = new TypesReader(payload, off, len);
26:
27: int packet_type = tr.readByte();
28:
29: if (packet_type != Packets.SSH_MSG_KEX_DH_GEX_REPLY)
30: throw new IOException(
31: "This is not a SSH_MSG_KEX_DH_GEX_REPLY! ("
32: + packet_type + ")");
33:
34: hostKey = tr.readByteString();
35: f = tr.readMPINT();
36: signature = tr.readByteString();
37:
38: if (tr.remain() != 0)
39: throw new IOException(
40: "PADDING IN SSH_MSG_KEX_DH_GEX_REPLY!");
41: }
42:
43: public BigInteger getF() {
44: return f;
45: }
46:
47: public byte[] getHostKey() {
48: return hostKey;
49: }
50:
51: public byte[] getSignature() {
52: return signature;
53: }
54: }
|