Link to home
Start Free TrialLog in
Avatar of vj_mi
vj_mi

asked on

Checking if file is tampered after encryption

Hi,

I am using VB.NEt for a desktop app. Now I have a feature that will export the data into a text file which will be later encrypted. This encrypted file will be copied by the user on a drive and transferred to another PC. Here we will decrypt the file and import the data.

Now my question is: what if the encrypted file is opened by the user and changes made? Due to this, the import routine will get some junk data. Hence I want that after the file is encrypted, we want to take the CRC check and then before importing we again check the CRC to ensure that file is not tampered. How do we accomplish this in VB.NET? Alternately is there any other better way to ensure that file is tampered?

Regards,
mi
Avatar of sognoct
sognoct
Flag of Italy image

md5 of a file is unique. So generating the md5 of the content will create an unique value (of fixed characters number)   that can be used as a crc.
Put that crc at the end of the file, or in the filename ad do the check on the other pc
Avatar of vj_mi
vj_mi

ASKER

But my file may be huge... say my employee table has 70,000 records. Now I write this data to the file. Now I want to generate crc for this complete file and not for the string. How do I write that md5 code. Second question is: if I add crc to the end of the file, how do I read it again?

Regards,
mi
ok ... so, md5 is unique also for 70.000 records.
You can put it on a new row at the end of the file, so just need to read it
fort the code of md5, are you using VB, c#, c++ ?
ASKER CERTIFIED SOLUTION
Avatar of sognoct
sognoct
Flag of Italy image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial