Reputation: 1
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;
Upvotes: 0
Views: 1559
Reputation: 2228
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
Upvotes: 2