Home | History | Annotate | Download | only in packets
      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 ch.ethz.ssh2.DHGexParameters;
      8 
      9 /**
     10  * PacketKexDhGexRequest.
     11  *
     12  * @author Christian Plattner
     13  * @version 2.50, 03/15/10
     14  */
     15 public class PacketKexDhGexRequest
     16 {
     17 	byte[] payload;
     18 
     19 	int min;
     20 	int n;
     21 	int max;
     22 
     23 	public PacketKexDhGexRequest(DHGexParameters para)
     24 	{
     25 		this.min = para.getMin_group_len();
     26 		this.n = para.getPref_group_len();
     27 		this.max = para.getMax_group_len();
     28 	}
     29 
     30 	public byte[] getPayload()
     31 	{
     32 		if (payload == null)
     33 		{
     34 			TypesWriter tw = new TypesWriter();
     35 			tw.writeByte(Packets.SSH_MSG_KEX_DH_GEX_REQUEST);
     36 			tw.writeUINT32(min);
     37 			tw.writeUINT32(n);
     38 			tw.writeUINT32(max);
     39 			payload = tw.getBytes();
     40 		}
     41 		return payload;
     42 	}
     43 }
     44