I want to decrypt the file line by line using DESCryptoServiceProvider(or any other algorithm). I can encrypt file but while decryption I cannot get exact line because cryptostream treats entire file as single message. Is there any solution available for it ?
Asked
Active
Viewed 247 times
1
-
1To be able to tell when one line ends and another starts, you would need some sort of file format which stores length information for the encrypted parts. Why not just encrypt the entire file all in one, instead of encrypting line by line? – Millie Smith Nov 21 '15 at 09:34
-
it's a bad idea to encrypt multiple lines with the same key anyways - just convert the file and encrypt it as one - that's what modern stream-ciphers are supposed to do – Random Dev Nov 21 '15 at 09:44
-
Arent all the blocks encrypted with same key Carsten? That's what I was thinking, maby you cannot decrypt line by line specifically, but decrypt block by block somehow (64-bit in DES) – NLindbom Nov 21 '15 at 09:46
-
It would be pretty terrible if every block was encrypted with the same key. I can't remember how DES works exactly, but surely it uses a keystream to make a new chunk of key material for each block and supports something such as CBC to further mess it up. – Matti Virkkunen Nov 21 '15 at 10:01
-
Possible duplicate of [Encrypting/decrypting a file line by line?](http://stackoverflow.com/questions/12999999/encrypting-decrypting-a-file-line-by-line) – Artjom B. Nov 21 '15 at 11:58