Reputation: 593
My C# WinForms application uses Microsoft® Office Word templates and other file formats to write and print data for reports. Those templates are sent to the users via emails and sharing services.
Is there some sort of signature, hidden property or unique identifier to add it to those template files and the application reads this signature to make sure that the files are the one sent to the user; because it will cause error if, for example, uses a template without the bookmarks ?
I have read about GetFileInformationByHandle
function in this post, but I am not sure of the outcome.
Upvotes: 0
Views: 308
Reputation: 638
You could use a Hash function to generate a Checksum to verify the file. Hash your template file, and append the checksum to the file. Read this at the end and verify it's the same as the one on your end (remembering to remove the checksum before rehashing the file), to prove the files are identical.
Upvotes: 1