Problem appending to an encrypted file

  • Thread starter Thread starter jasper
  • Start date Start date
Jasper,

Sure, but you can't just write to the file. Most encryption methods are
based on values that were encrypted earlier in the file, so just appending
to the end would prevent decryption.

What you really need to do is decrypt the data in the file, append to
that data, then re-encrypt the file.

Hope this helps.
 
This guy did it....I cant get it working tho...
http://www.mcse.ms/archive113-2004-10-1157980.html
Nicholas Paldino said:
Jasper,

Sure, but you can't just write to the file. Most encryption methods
are based on values that were encrypted earlier in the file, so just
appending to the end would prevent decryption.

What you really need to do is decrypt the data in the file, append to
that data, then re-encrypt the file.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

jasper said:
How can this be done?

Thanks
 
Do it record based. So each record gets encrypted/decrypted independently
of other records. That way, your not dependant on anything before or after
a record. Probably what I would do is length prepend each record instead of
using delimiter(s).

--
William Stacey [MVP]

jasper said:
This guy did it....I cant get it working tho...
http://www.mcse.ms/archive113-2004-10-1157980.html
Nicholas Paldino said:
Jasper,

Sure, but you can't just write to the file. Most encryption methods
are based on values that were encrypted earlier in the file, so just
appending to the end would prevent decryption.

What you really need to do is decrypt the data in the file, append to
that data, then re-encrypt the file.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

jasper said:
How can this be done?

Thanks
 
jasper said:
This guy did it....I cant get it working tho...
http://www.mcse.ms/archive113-2004-10-1157980.html

Read carefully what Valery says in this thread, he's very respected for
his knowledge about security.

The reasons for CBC and padding are to make your encryption as secure as
possible. If you decide to remove padding, and to change the cipher mode
to ECB, then you give crackers a small advantage because repeated blocks
in the cleartext may appear in the ciphertext. You have to ba;ance the
reduction in your security with the advantage you get of being able to
append blocks to the end of encrypted text.

Personally, where security is concerned, I don't think anything is worth
having to compromise your security.

Here's some more about private key cryptography:

http://www.grimes.demon.co.uk/workshops/secWSTen.htm

Richard
 
Back
Top