0
|
1 package com.trilead.ssh2.packets;
|
|
2
|
|
3 import java.io.IOException;
|
|
4
|
|
5 import java.math.BigInteger;
|
|
6
|
|
7 /**
|
|
8 * PacketKexDhGexGroup.
|
|
9 *
|
|
10 * @author Christian Plattner, plattner@trilead.com
|
|
11 * @version $Id: PacketKexDhGexGroup.java,v 1.1 2007/10/15 12:49:55 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) throws IOException {
|
|
20 this.payload = new byte[len];
|
|
21 System.arraycopy(payload, off, this.payload, 0, len);
|
|
22 TypesReader tr = new TypesReader(payload, off, len);
|
|
23 int packet_type = tr.readByte();
|
|
24
|
|
25 if (packet_type != Packets.SSH_MSG_KEX_DH_GEX_GROUP)
|
|
26 throw new IllegalArgumentException(
|
|
27 "This is not a SSH_MSG_KEX_DH_GEX_GROUP! (" + packet_type
|
|
28 + ")");
|
|
29
|
|
30 p = tr.readMPINT();
|
|
31 g = tr.readMPINT();
|
|
32
|
|
33 if (tr.remain() != 0)
|
|
34 throw new IOException("PADDING IN SSH_MSG_KEX_DH_GEX_GROUP!");
|
|
35 }
|
|
36
|
|
37 public BigInteger getG() {
|
|
38 return g;
|
|
39 }
|
|
40
|
|
41 public BigInteger getP() {
|
|
42 return p;
|
|
43 }
|
|
44 }
|