01: package ch.ethz.ssh2.packets;
02:
03: import java.io.IOException;
04:
05: import java.math.BigInteger;
06:
07: /**
08: * PacketKexDHReply.
09: *
10: * @author Christian Plattner, plattner@inf.ethz.ch
11: * @version $Id: PacketKexDHReply.java,v 1.2 2005/08/24 17:54:09 cplattne Exp $
12: */
13: public class PacketKexDHReply {
14: byte[] payload;
15:
16: byte[] hostKey;
17: BigInteger f;
18: byte[] signature;
19:
20: public PacketKexDHReply(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_KEXDH_REPLY)
30: throw new IOException(
31: "This is not a SSH_MSG_KEXDH_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("PADDING IN SSH_MSG_KEXDH_REPLY!");
40: }
41:
42: public BigInteger getF() {
43: return f;
44: }
45:
46: public byte[] getHostKey() {
47: return hostKey;
48: }
49:
50: public byte[] getSignature() {
51: return signature;
52: }
53: }
|