Quantcast
Channel: sshnet Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 1026

Edited Issue: BlockCipher.Encrypt fails if input message is not padded [2547]

$
0
0
BlockCipher.Encrypt fails if input message length is not a multiple of BlockSize. The error is "Invalid output buffer".

This seems to be due to the following code in EncryptBlock function of BlockCipher class:

var output = new byte[data.Length];

if (data.Length % this._blockSize > 0)
{
if (this._padding == null)
{
throw new ArgumentException("data");
}
data = this._padding.Pad(this._blockSize, data);
}

The size of output array is determined before the padding of input data. As a result, after the padding input array is longer than output array.

The same applies to Decrypt function.
Comments: ** Comment from web user: drieseng **

Fixed in changeset 40826.

Thanks for the report!


Viewing all articles
Browse latest Browse all 1026

Trending Articles