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