public override void Write(byte[] buffer, int offset, int count)
{
if (_mode == CryptoMode.Decrypt)
{
throw new NotSupportedException("This stream does not Decrypt via Write()");
}
if (buffer == null)
{
throw new ArgumentNullException("buffer");
}
// workitem 7696
if (count == 0)
{
return;
}
byte[] plaintext = null;
if (offset != 0)
{
plaintext = new byte[count];
for (int i = 0; i < count; i++)
{
plaintext[i] = buffer[offset + i];
}
}
else
{
plaintext = buffer;
}
byte[] encrypted = _cipher.EncryptMessage(plaintext, count);
_s.Write(encrypted, 0, encrypted.Length);
}