comparison src/com/trilead/ssh2/packets/PacketKexDHReply.java @ 0:0ce5cc452d02

initial version
author Carl Byington <carl@five-ten-sg.com>
date Thu, 22 May 2014 10:41:19 -0700
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:0ce5cc452d02
1 package com.trilead.ssh2.packets;
2
3 import java.io.IOException;
4
5 /**
6 * PacketKexDHReply.
7 *
8 * @author Christian Plattner, plattner@trilead.com
9 * @version $Id: PacketKexDHReply.java,v 1.1 2007/10/15 12:49:55 cplattne Exp $
10 */
11 public class PacketKexDHReply {
12 byte[] payload;
13
14 byte[] hostKey;
15 byte[] publicKey;
16 byte[] signature;
17
18 public PacketKexDHReply(byte payload[], int off, int len) throws IOException {
19 this.payload = new byte[len];
20 System.arraycopy(payload, off, this.payload, 0, len);
21 TypesReader tr = new TypesReader(payload, off, len);
22 int packet_type = tr.readByte();
23
24 if (packet_type != Packets.SSH_MSG_KEXDH_REPLY)
25 throw new IOException("This is not a SSH_MSG_KEXDH_REPLY! ("
26 + packet_type + ")");
27
28 hostKey = tr.readByteString();
29 publicKey = tr.readByteString();
30 signature = tr.readByteString();
31
32 if (tr.remain() != 0) throw new IOException("PADDING IN SSH_MSG_KEXDH_REPLY!");
33 }
34
35 public byte[] getF() {
36 return publicKey;
37 }
38
39 public byte[] getHostKey() {
40 return hostKey;
41 }
42
43 public byte[] getSignature() {
44 return signature;
45 }
46 }