Original:
I am working on writing a program that performs encryption uses triple-DES.
I am reading(decrypting) and writing(encrypting) a linked list to a file.
The program will read and write the individual structures that make up the
linked list using OpenSSL. The problem that I am running into, is that I
cannot figure out a way to check to ensure that the data that is being
decrypted, is actually being decrypted properly. In other words, if I write
out my linked list, encrypting each structure as I write it I end up with a
file that is encrypted. If I edit the file using a binary file
editor(emacs), and I try and run the decryption program, the output to the
screen is human readable, until it hits the point where I made changes in
the encrypted file. Is there a way to stop the decryption once the data is
deemed to be "bad".
Reply:
There are any number of ways to do this. A very simple way is to add a
checksum field to the decrypted data and encrypt it along with the data.
When you decrypt the data, decrypt the checksum field along with it and then
compute the checksum of the data (less the checksum field itself) and verify
it against the decrypted checksum field. If they don't match, reject the
data.
DS
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]