Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I read the digital signature information from a signed .Net assembly?

I am writing an assembly information application to be used in our software build process and am trying to read the digital signature information from a signed .Net assembly.

I want to do in my C# code what Windows Explorer can do by right-clicking a signed assembly and selecting the "Digital Signatures" tab and then clicking the Details button. e.g.

Windows 7 Explorer can do by right-clicking file properties

Digital signature details

Has anyone got an idea how to do this programmatically in C#? I am currently using the Mono Cecil library to get the rest of the information from the assembly. Your help will be most appreciated.

like image 865
VinceJS Avatar asked May 11 '12 10:05

VinceJS


People also ask

How do I find my assembly signature?

To detect whether the assembly file is signed or not, right click on the file and click the 'Properties' from the context menu. If you see a 'Digital Signatures' tab in the properties window, that means, the file is signed by a digital signature (as shown below).

How do you tell if .NET assembly is signed?

Open the properties sheet for the . dll from Windows Explorer. If a tab "Digital Signatures" is shown, it's a signed assembly. If the tab is missing, it's unsigned.

What steps are performed by the signer of a digital signature?

When a signer electronically signs a document, the signature is created using the signer's private key, which is always securely kept by the signer. The mathematical algorithm acts as a cypher, creating data matching the signed document, called a hash, and encrypting that data.


1 Answers

The Mono project provides source code for both signcode and chktrust that you can re-use inside your own application (open source, MIT X11 licensed).

Both use Mono.Security.dll assembly (which works under Windows, not just Linux and OSX) and include a quite complete Authenticode support.

like image 119
poupou Avatar answered Oct 06 '22 19:10

poupou