Many files we download don't have digital signatures. Files may get infected or someone may intentionally modify them on our hard disk.
So I wrote a simple file hashing program in c# that creates a SHA-256 hash of each file & stores it in a signed XML document. The private key is taken from the Windows certificate store with a High security level. (That is, each time I use the private key it asks me for the password.) I also created a Property sheet for folders & icon overlays (basically shows a check image on a file's icon if hash is ok) so that I can see at a glance which files are ok. This program also backs up the list of hashes on Google Drive and automatically syncs our hash database. I also added Authenticode to my program files.
So I have some questions in mind:
Is it possible for malware or any kind of exploit which is running with admin privileges to dump the private key without the password? (The keys are in User Store with High security.)
Is it possible to exploit my program so that even if a file is modified it will show it as still matching the stored hash? (I am on Windows 8 x64 with DEP & ASLR on.)
The program's executable checks its own digital signature & other DLLs it loads. So if it is invalid it exists. Is this ok?
If the program is not secure how can I improve it to be secure?
Primarily, I want to make sure that files I use are not tampered with even if my computer is compromised. ( I know Open PGP but I just want to store file hash & other attributes like file length in bytes, which user created each signature, date/time in cleartext in signed XML so that my friends can also check hash with other software, etc.)