C#: why sign an assembly?

后端 未结 7 802
太阳男子
太阳男子 2020-11-28 02:04

In some C# code I have taken over (in Visual Studio 2005), I have noticed that the assemblies are all signed with the same .snk file.

  • Wh
7条回答
  •  时光说笑
    2020-11-28 02:44

    A very important reason to sign an assembly is so you can be sure it is your assembly. Since the private key is yours, nobody else can sign an assembly with that same key. This means that when the public key of an assembly is one you know (you can retrieve this using the GetType().Assembly.GetName().GetPublicKey() function), the assembly is yours and it has not been tampered with.

提交回复
热议问题