comparison app/src/main/java/ch/ethz/ssh2/packets/PacketKexDhGexReply.java @ 438:d29cce60f393

migrate from Eclipse to Android Studio
author Carl Byington <carl@five-ten-sg.com>
date Thu, 03 Dec 2015 11:23:55 -0800
parents src/ch/ethz/ssh2/packets/PacketKexDhGexReply.java@071eccdff8ea
children
comparison
equal deleted inserted replaced
437:208b31032318 438:d29cce60f393
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 int packet_type = tr.readByte();
26
27 if (packet_type != Packets.SSH_MSG_KEX_DH_GEX_REPLY) {
28 throw new PacketTypeException(packet_type);
29 }
30
31 hostKey = tr.readByteString();
32 f = tr.readMPINT();
33 signature = tr.readByteString();
34
35 if (tr.remain() != 0) {
36 throw new PacketFormatException(String.format("Padding in %s", Packets.getMessageName(packet_type)));
37 }
38 }
39
40 public BigInteger getF() {
41 return f;
42 }
43
44 public byte[] getHostKey() {
45 return hostKey;
46 }
47
48 public byte[] getSignature() {
49 return signature;
50 }
51 }