comparison src/ch/ethz/ssh2/packets/PacketKexDhGexReply.java @ 273:91a31873c42a ganymed

start conversion from trilead to ganymed
author Carl Byington <carl@five-ten-sg.com>
date Fri, 18 Jul 2014 11:21:46 -0700
parents
children 071eccdff8ea
comparison
equal deleted inserted replaced
272:ce2f4e397703 273:91a31873c42a
1 /*
2 * Copyright (c) 2006-2011 Christian Plattner. All rights reserved.
3 * Please refer to the LICENSE.txt for licensing details.
4 */
5 package ch.ethz.ssh2.packets;
6
7 import java.io.IOException;
8 import java.math.BigInteger;
9
10 import ch.ethz.ssh2.PacketFormatException;
11 import ch.ethz.ssh2.PacketTypeException;
12
13 /**
14 * @author Christian Plattner
15 * @version $Id: PacketKexDhGexReply.java 160 2014-05-01 14:30:26Z dkocher@sudo.ch $
16 */
17 public final class PacketKexDhGexReply {
18
19 private final byte[] hostKey;
20 private final BigInteger f;
21 private final byte[] signature;
22
23 public PacketKexDhGexReply(byte payload[]) throws IOException {
24 TypesReader tr = new TypesReader(payload);
25
26 int packet_type = tr.readByte();
27
28 if(packet_type != Packets.SSH_MSG_KEX_DH_GEX_REPLY) {
29 throw new PacketTypeException(packet_type);
30 }
31
32 hostKey = tr.readByteString();
33 f = tr.readMPINT();
34 signature = tr.readByteString();
35
36 if(tr.remain() != 0) {
37 throw new PacketFormatException(String.format("Padding in %s", Packets.getMessageName(packet_type)));
38 }
39 }
40
41 public BigInteger getF() {
42 return f;
43 }
44
45 public byte[] getHostKey() {
46 return hostKey;
47 }
48
49 public byte[] getSignature() {
50 return signature;
51 }
52 }