While encrypting data with DES through CryptoStream makes encrypted data bigger than original string. if we have 8 byte key and 8 byte of data then the mode is ECB. output encrypted data is 16 bytes long. first 8 bytes is out encrypted key but last 8 byte unknown. and while decrypting if we couldn't supply this 8 bytes we couldnt decrypt data. and get exception "Bad Data"
What is this 8 bytes
and how can i supply this data if i have only the encrypted 8 bytes.

Re: CryptoStream makes encrypted data bigger than original string by Ed

Ed
Fri Feb 06 12:54:05 CST 2004

Many algorithms aren't byte-to-byte encryptions. As a result, you'll end up
with more bytes in ciphertext than you had in cleartext.

"Burke Atilla" <burke@verisoft.com.tr> wrote in message
news:3769A917-EA7E-4609-A355-343A81C5856E@microsoft.com...
> While encrypting data with DES through CryptoStream makes encrypted data
bigger than original string. if we have 8 byte key and 8 byte of data then
the mode is ECB. output encrypted data is 16 bytes long. first 8 bytes is
out encrypted key but last 8 byte unknown. and while decrypting if we
couldn't supply this 8 bytes we couldnt decrypt data. and get exception "Bad
Data".
> What is this 8 bytes?
> and how can i supply this data if i have only the encrypted 8 bytes.



Re: CryptoStream makes encrypted data bigger than original string by Christian

Christian
Mon Feb 09 03:48:18 CST 2004

Because of the fact that DES is a block cipher, the output data's length is
a multiple of the algorithm's block size. So you have to save the complete
output in order to decrypt. If you want a byte-wise encryption instead, you
have to use a stream cipher. I don't think there's a stream cipher included
in .NET framework. Anyway, the implementation of a CryptoServiceProvider for
RC4 shouldn't be too hard.

Greets, Christian