Refactored creating of key exchange algorithm to allow unit tests without encyption and decryption.
Added tests for KeyExchangeDhGroupExchangeRequest and IgnoreMessage.
Added large set of tests for Session in both connected and disconnected mode.
Remove SshData.ReadInt64() and SshData.Write(long). Fixes issue #2579.
* Removed DataTypeCode from ChannelDataEventArgs, as this is specific to extended data.
* Large set of optimizations in receive and send of SSH messages:
- removed several buffer copies
- modified most of the SSH messages to allow the size of the message to be calculated in advance to eliminate need to resize buffer.
- added Compress(byte[] data, int offset, int length) overload to Compressor to compress part of a given buffer thereby avoiding need for buffer copy.
- added Encrypt(byte[] data, int offset, int length) overload to Cipher to encrypt part of a given buffer thereby avoiding need for buffer copy.
* SshData:
- SshData.GetBytes uses a SshDataStream which has a capacity that (in almost all cases) matches the size of the SSH message.
- Added a Load(byte[] value, int offset) overload.
- Added a LoadBytes(byte[] bytes, int offset) overload.
- Added a Write(byte[] data) overload.
- Added a Write(byte[] buffer, int offset, int count) overload.
* Added SendData(byte[] data, int offset, int size) overload to Channel to allow sending part of a given buffer.
This avoids a buffer copy in ScpClient, SftpClient, Shell, ChannelDirectTcpip, ChannelForwardedTcpip.
Fixes issue #1516.
All optimization changes above are only active when the TUNING conditional compilation symbol is defined.
By default, this symbol is defined.
Use TrySendMessage to send SSH_MSG_DISCONNECT, SSH_MSG_CHANNEL_EOF, SSH_MSG_CHANNEL_CLOSE and SSH_MSG_IGNORE messages to avoid throwing exceptions while closing/disposing or sending keep-alive messages.
Avoid sending multiple keep-alive messages concurrently for the same client.
Fixed regression in multi-factor authentication.