0
votes

I read article about "Signing an Assembly with a Strong Name";
http://resources.infosecinstitute.com/dot-net-assemblies-and-strong-name-signature/;
then I learned to get public key and public key token;
but the question :;
How can I get the digital signature from the assembly?
and how I can extract the hash from the digital signature?
I prefer to use ildasm;
thank you;

1
What exactly do you want to see? Do you want to check it for yourself or do you have to write code to check it?Waescher
The article already mentions using the sn tool to verify the signature , display the token with sn -T(probably what you mean by hash) or extract the public key. Have you tried it?Panagiotis Kanavos
I want to see the hash.mukhtar ghaleb
to Panagiotis Kanavos, No, the hash isn't the publickeytoken;mukhtar ghaleb

1 Answers

2
votes

One way is to do this from C#, if you would prefer it:

// Load the certificate from your DLL file

var cert = X509Certificate.CreateFromSignedFile("path to your assembly");

// Create an instance of X509Certificate2

var cert2 = new X509Certificate2(cert);

// Use `GetCertHash()` to extract certificate's hash

var hash = cert2.GetCertHash();

Documentation about types used:

X509Certificate: https://msdn.microsoft.com/en-us/library/system.security.cryptography.x509certificates.x509certificate%28v=vs.110%29.aspx

X509Certificate2: https://msdn.microsoft.com/en-us/library/system.security.cryptography.x509certificates.x509certificate2%28v=vs.110%29.aspx