开发者

How to view public key tokens on DLL's

Does anyone know of a way to view the public key token on a DLL? I'm investigating a possible mismatch between what is expected in code and what is being built.

Thanks in advan开发者_高级运维ce, It Grunt


Use

Assembly.GetExecutingAssembly().GetName().GetPublicKeyToken();

or

sn -T YourAssembly.dll


sn -Tp assembly.dll

will tell you what you need to know


I started using ILSpy, alternative for Reflector.NET. After opening dll, you can view public key token, version and more.


For DLL without .Net, using pktextract to get publicKeyToken
https://learn.microsoft.com/en-us/windows/win32/sbscs/pktextract-exe

Step1. extract .cer from dll
Right click the file, select 'Properties' then 'Digital Signatures', you may see the certificate inside.
Then select one and choose 'View Certificate' -> 'Details' -> 'Copy to File'.

Step2. We assume the file is 'D:\test.cer', then using this tool to get the publicKeyToken.

C:\> pktextract D:\test.cer
Microsoft (R) Side-By-Side Public Key Token Extractor
Copyright (C) Microsoft Corporation. All Rights Reserved

Certificate: "my-Test" - 2048 bits long
        publicKeyToken="ea1b32b5bee7776f"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜