KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ch > ethz > ssh2 > packets > PacketKexDhGexReply


1
2 package ch.ethz.ssh2.packets;
3
4 import java.io.IOException JavaDoc;
5
6 import java.math.BigInteger JavaDoc;
7
8 /**
9  * PacketKexDhGexReply.
10  *
11  * @author Christian Plattner, plattner@inf.ethz.ch
12  * @version $Id: PacketKexDhGexReply.java,v 1.2 2005/08/24 17:54:09 cplattne Exp $
13  */

14 public class PacketKexDhGexReply
15 {
16     byte[] payload;
17
18     byte[] hostKey;
19     BigInteger JavaDoc f;
20     byte[] signature;
21
22     public PacketKexDhGexReply(byte payload[], int off, int len) throws IOException JavaDoc
23     {
24         this.payload = new byte[len];
25         System.arraycopy(payload, off, this.payload, 0, len);
26
27         TypesReader tr = new TypesReader(payload, off, len);
28
29         int packet_type = tr.readByte();
30
31         if (packet_type != Packets.SSH_MSG_KEX_DH_GEX_REPLY)
32             throw new IOException JavaDoc("This is not a SSH_MSG_KEX_DH_GEX_REPLY! (" + 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 JavaDoc("PADDING IN SSH_MSG_KEX_DH_GEX_REPLY!");
40     }
41
42     public BigInteger JavaDoc getF()
43     {
44         return f;
45     }
46
47     public byte[] getHostKey()
48     {
49         return hostKey;
50     }
51
52     public byte[] getSignature()
53     {
54         return signature;
55     }
56 }
57
Popular Tags