Which type of key .NET assemblies uses for signing and how to create it?
-
20-08-2019 - |
Question
I have read many MSDN articles about assembly signing and I haven't found nothing about creating the key, just about creating the file, but the 3 methods listed to create a file needs a pre-generated key. Can you provide me a link to a tutorial to this?
Solution
Here's how you create a new Public/Private key pair. You can do the same thing from within the VS UI - see Signing tab in Project Properties.
OTHER TIPS
As Anton suggests, you can generate one easily using sn.exe. The problem with this is that it's no good for verifiying your identity as a publisher because there is no trust chain established for self-generated keys. If you want to sign your assemblies so that your identity can be verified then you'll need to get a certificate from a trusted supplier, such as Verisign.
You can use the Sn.exe provide by microsoft to generate à Key pair.
After that you ll have to do:
[assembly: AssemblyKeyFileAttribute(@"..\..\key.snk")]
Hope this could help :)