【问题标题】:How can I see digital signature in assembly?如何在程序集中查看数字签名?
【发布时间】:2015-09-29 13:39:10
【问题描述】:

我阅读了有关“使用强名称签署程序集”的文章;
http://resources.infosecinstitute.com/dot-net-assemblies-and-strong-name-signature/;
然后我学会了获取公钥和公钥令牌;
但问题:;
如何从程序集中获取数字签名?
以及如何从数字签名中提取哈希?
我更喜欢使用 ildasm;
谢谢;

【问题讨论】:

  • 您到底想看什么?是自己检查还是要自己写代码检查?
  • 文章已经提到使用sn工具验证签名,用sn -T显示令牌(可能你的意思是哈希)或提取公钥。你试过了吗?
  • 我想看哈希。
  • 对 Panagiotis Kanavos,不,哈希不是 publickeytoken;

标签: c# .net winforms .net-assembly


【解决方案1】:

如果您愿意,一种方法是从 C# 中执行此操作:

// 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();

有关使用类型的文档:

X509证书: 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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-05-24
    • 2012-05-19
    • 1970-01-01
    • 2011-12-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多