C# check if a file is signed

EmperorIQ

Platinum Member
Sep 30, 2003
2,003
0
0
Hi,

Does anyone know how to check if a file is signed, and to also look for the timestamp of that file in C#?

I am trying to code the same functionality that sigcheck.exe has, but in C#.

Thanks in advance!
 

EmperorIQ

Platinum Member
Sep 30, 2003
2,003
0
0
Signed by anything. I just want to be able to have some function check any file and be able to tell you "yes" this file is digitally signed, or "no" this file isn't digitally signed.
 

beggerking

Golden Member
Jan 15, 2006
1,703
0
0
umm.. you mean like... a CRC check on data bits?

or something as in a web page being digitally "signed"?
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
There are code signing certs for EXEs, .Net assemblies and java applets that work similarly to SSL certs.

If you right-click on a signed EXE in Windows Explorer and choose Properties, you'll see a Digital Signatures tab.

But without RTFDocs I don't know what APIs (if any exist for Win32 or .Net) can be used to extract this information. I've only ever used the command-line tools to sign installs at work.
 

EmperorIQ

Platinum Member
Sep 30, 2003
2,003
0
0
Originally posted by: DaveSimmons
There are code signing certs for EXEs, .Net assemblies and java applets that work similarly to SSL certs.

If you right-click on a signed EXE in Windows Explorer and choose Properties, you'll see a Digital Signatures tab.

But without RTFDocs I don't know what APIs (if any exist for Win32 or .Net) can be used to extract this information. I've only ever used the command-line tools to sign installs at work.

bummer, I was afraid of that. But that's what I was looking for. Instead of right clicking every file, and seeing if its digitally signed via properties, I was hoping taht I can have a tool that browses a folder.

SigCheck works fine, and I love it, but at work here, some people were complaining that command line tools aren't easy enough to use, so i was assigned the task of writing one with a UI. I think I am going to just create a wrapper around sigcheck.exe instead then.

Thanks!
 

InYourFace

Junior Member
Mar 30, 2006
4
0
61
Check out the System.IO.FileInfo class. I'm pretty sure you can change the attributes of the file that way. Here is a link with more Info.