boolean flush(boolean canAwaitExpansion) throws TransportException, ConnectionException { return flush(packet.wpos() - dataOffset, canAwaitExpansion); }
int write(byte[] data, int off, int len) throws TransportException, ConnectionException { final int bufferSize = packet.wpos() - dataOffset; if (bufferSize >= win.getMaxPacketSize()) { flush(bufferSize, true); return 0; } else { final int n = Math.min(len, win.getMaxPacketSize() - bufferSize); packet.putRawBytes(data, off, n); return n; } }
DataBuffer() { headerOffset = packet.rpos(); packet.putUInt32(0); // recipient packet.putUInt32(0); // data length dataOffset = packet.wpos(); }
private void putMAC(SSHPacket buffer, int startOfPacket, int endOfPadding) { buffer.wpos(endOfPadding + mac.getBlockSize()); mac.update(seq); mac.update(buffer.array(), startOfPacket, endOfPadding); mac.doFinal(buffer.array(), endOfPadding); }
inputBuffer.wpos(packetLength + 4 - inputBuffer.readByte()); final SSHPacket plain = usingCompression() ? decompressed() : inputBuffer; if (log.isTraceEnabled()) {
checkMAC(inputBuffer.array()); decryptBuffer(4, packetLength); inputBuffer.wpos(packetLength + 4 - inputBuffer.readByte()); final SSHPacket plain = usingCompression() ? decompressed() : inputBuffer; if (log.isTraceEnabled()) {
public Proposal(Config config) { kex = Factory.Named.Util.getNames(config.getKeyExchangeFactories()); sig = Factory.Named.Util.getNames(config.getSignatureFactories()); c2sCipher = s2cCipher = Factory.Named.Util.getNames(config.getCipherFactories()); c2sMAC = s2cMAC = Factory.Named.Util.getNames(config.getMACFactories()); c2sComp = s2cComp = Factory.Named.Util.getNames(config.getCompressionFactories()); packet = new SSHPacket(Message.KEXINIT); // Put cookie packet.ensureCapacity(16); config.getRandomFactory().create().fill(packet.array(), packet.wpos(), 16); packet.wpos(packet.wpos() + 16); // Put algorithm lists packet.putString(toCommaString(kex)); packet.putString(toCommaString(sig)); packet.putString(toCommaString(c2sCipher)); packet.putString(toCommaString(s2cCipher)); packet.putString(toCommaString(c2sMAC)); packet.putString(toCommaString(s2cMAC)); packet.putString(toCommaString(c2sComp)); packet.putString(toCommaString(s2cComp)); packet.putString(""); packet.putString(""); packet.putBoolean(false); // Optimistic next packet does not follow packet.putUInt32(0); // "Reserved" for future by spec }
boolean flush(boolean canAwaitExpansion) throws TransportException, ConnectionException { return flush(packet.wpos() - dataOffset, canAwaitExpansion); }
boolean flush(boolean canAwaitExpansion) throws TransportException, ConnectionException { return flush(packet.wpos() - dataOffset, canAwaitExpansion); }
int write(byte[] data, int off, int len) throws TransportException, ConnectionException { final int bufferSize = packet.wpos() - dataOffset; if (bufferSize >= win.getMaxPacketSize()) { flush(bufferSize, true); return 0; } else { final int n = Math.min(len, win.getMaxPacketSize() - bufferSize); packet.putRawBytes(data, off, n); return n; } }
DataBuffer() { headerOffset = packet.rpos(); packet.putUInt32(0); // recipient packet.putUInt32(0); // data length dataOffset = packet.wpos(); }
DataBuffer() { headerOffset = packet.rpos(); packet.putUInt32(0); // recipient packet.putUInt32(0); // data length dataOffset = packet.wpos(); }
int write(byte[] data, int off, int len) throws TransportException, ConnectionException { final int bufferSize = packet.wpos() - dataOffset; if (bufferSize >= win.getMaxPacketSize()) { flush(bufferSize, true); return 0; } else { final int n = Math.min(len, win.getMaxPacketSize() - bufferSize); packet.putRawBytes(data, off, n); return n; } }
private SSHPacket checkHeaderSpace(SSHPacket buffer) { if (buffer.rpos() < 5) { log.warn("Performance cost: when sending a packet, ensure that " + "5 bytes are available in front of the buffer"); SSHPacket nb = new SSHPacket(buffer.available() + 5); nb.rpos(5); nb.wpos(5); nb.putBuffer(buffer); buffer = nb; } return buffer; }
private void putMAC(SSHPacket buffer, int startOfPacket, int endOfPadding) { buffer.wpos(endOfPadding + mac.getBlockSize()); mac.update(seq); mac.update(buffer.array(), startOfPacket, endOfPadding); mac.doFinal(buffer.array(), endOfPadding); }
private void putMAC(SSHPacket buffer, int startOfPacket, int endOfPadding) { buffer.wpos(endOfPadding + mac.getBlockSize()); mac.update(seq); mac.update(buffer.array(), startOfPacket, endOfPadding); mac.doFinal(buffer.array(), endOfPadding); }
public Proposal(Config config) { kex = Factory.Named.Util.getNames(config.getKeyExchangeFactories()); sig = Factory.Named.Util.getNames(config.getSignatureFactories()); c2sCipher = s2cCipher = Factory.Named.Util.getNames(config.getCipherFactories()); c2sMAC = s2cMAC = Factory.Named.Util.getNames(config.getMACFactories()); c2sComp = s2cComp = Factory.Named.Util.getNames(config.getCompressionFactories()); packet = new SSHPacket(Message.KEXINIT); // Put cookie packet.ensureCapacity(16); config.getRandomFactory().create().fill(packet.array(), packet.wpos(), 16); packet.wpos(packet.wpos() + 16); // Put algorithm lists packet.putString(toCommaString(kex)); packet.putString(toCommaString(sig)); packet.putString(toCommaString(c2sCipher)); packet.putString(toCommaString(s2cCipher)); packet.putString(toCommaString(c2sMAC)); packet.putString(toCommaString(s2cMAC)); packet.putString(toCommaString(c2sComp)); packet.putString(toCommaString(s2cComp)); packet.putString(""); packet.putString(""); packet.putBoolean(false); // Optimistic next packet does not follow packet.putUInt32(0); // "Reserved" for future by spec }
public Proposal(Config config) { kex = Factory.Named.Util.getNames(config.getKeyExchangeFactories()); sig = Factory.Named.Util.getNames(config.getSignatureFactories()); c2sCipher = s2cCipher = Factory.Named.Util.getNames(config.getCipherFactories()); c2sMAC = s2cMAC = Factory.Named.Util.getNames(config.getMACFactories()); c2sComp = s2cComp = Factory.Named.Util.getNames(config.getCompressionFactories()); packet = new SSHPacket(Message.KEXINIT); // Put cookie packet.ensureCapacity(16); config.getRandomFactory().create().fill(packet.array(), packet.wpos(), 16); packet.wpos(packet.wpos() + 16); // Put algorithm lists packet.putString(toCommaString(kex)); packet.putString(toCommaString(sig)); packet.putString(toCommaString(c2sCipher)); packet.putString(toCommaString(s2cCipher)); packet.putString(toCommaString(c2sMAC)); packet.putString(toCommaString(s2cMAC)); packet.putString(toCommaString(c2sComp)); packet.putString(toCommaString(s2cComp)); packet.putString(""); packet.putString(""); packet.putBoolean(false); // Optimistic next packet does not follow packet.putUInt32(0); // "Reserved" for future by spec }