1 package ch.ethz.ssh2.packets; 2 3 import java.io.IOException ; 4 5 11 public class PacketNewKeys 12 { 13 byte[] payload; 14 15 public PacketNewKeys() 16 { 17 } 18 19 public PacketNewKeys(byte payload[], int off, int len) throws IOException 20 { 21 this.payload = new byte[len]; 22 System.arraycopy(payload, off, this.payload, 0, len); 23 24 TypesReader tr = new TypesReader(payload, off, len); 25 26 int packet_type = tr.readByte(); 27 28 if (packet_type != Packets.SSH_MSG_NEWKEYS) 29 throw new IOException ("This is not a SSH_MSG_NEWKEYS! (" 30 + packet_type + ")"); 31 32 if (tr.remain() != 0) 33 throw new IOException ("Padding in SSH_MSG_NEWKEYS packet!"); 34 } 35 36 public byte[] getPayload() 37 { 38 if (payload == null) 39 { 40 TypesWriter tw = new TypesWriter(); 41 tw.writeByte(Packets.SSH_MSG_NEWKEYS); 42 payload = tw.getBytes(); 43 } 44 return payload; 45 } 46 } 47 | Popular Tags |