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 9 import java.math.BigInteger; 10 11 /** 12 * PacketKexDhGexReply. 13 * 14 * @author Christian Plattner 15 * @version 2.50, 03/15/10 16 */ 17 public class PacketKexDhGexReply 18 { 19 byte[] payload; 20 21 byte[] hostKey; 22 BigInteger f; 23 byte[] signature; 24 25 public PacketKexDhGexReply(byte payload[], int off, int len) throws IOException 26 { 27 this.payload = new byte[len]; 28 System.arraycopy(payload, off, this.payload, 0, len); 29 30 TypesReader tr = new TypesReader(payload, off, len); 31 32 int packet_type = tr.readByte(); 33 34 if (packet_type != Packets.SSH_MSG_KEX_DH_GEX_REPLY) 35 throw new IOException("This is not a SSH_MSG_KEX_DH_GEX_REPLY! (" + packet_type + ")"); 36 37 hostKey = tr.readByteString(); 38 f = tr.readMPINT(); 39 signature = tr.readByteString(); 40 41 if (tr.remain() != 0) 42 throw new IOException("PADDING IN SSH_MSG_KEX_DH_GEX_REPLY!"); 43 } 44 45 public BigInteger getF() 46 { 47 return f; 48 } 49 50 public byte[] getHostKey() 51 { 52 return hostKey; 53 } 54 55 public byte[] getSignature() 56 { 57 return signature; 58 } 59 } 60