Strong Names: How To Specify Public & Private Key? RRS feed

  • Question

  • The MSDN documentation for creating strong names states the following:


    The following command creates a new, random key pair and stores it in keyPair.snk.



    sn -k keyPair.snk

    I want to specify the private/public key instead of using a random key pair. How do I do that? 

    Plus, what is the purpose of using a random key pair? What would it identifiy?

    Sunday, December 2, 2007 9:05 PM

All replies

  • Hi Price,


        I think this can be a solution for your problem,,guid,d106bd87-1718-4ee6-94f8-ac2644c9196a.aspx.


       As for the purpose of the random key pair, i think this is usefull for companies that don't have any specific private key, and so they will generate a random one, and then use always the same in all their projects, and that will identify that the projects are theirs, because if the projects are registered regarding Intelectual Property then the Strong Key will also be there, and than will identity their ownership.


    Hope this helps you.




    Tuesday, December 4, 2007 11:05 PM
  • Thanks for your reply. But I still do not understand what benefit arises from having a key pair that cannot be identified. Anybody can generate a key pair but nobody can identify what they are or who they belong to. How does that protect anything or identify anything?


    Apparently, from examining the link referenced above, the C# code is generating a strong name file from unspecified key pairs.


    Is the only benefit from using a strong name that there is a hash generated when signing an assembly that will not match if the assembly is altered by tampering?


    We use Authenticode certificates to sign our assemblies that are bundled with some Microsoft products. Authenticode uses easily understood and identified key pairs. We are now required by Microsoft to use strong name signing in addition to our Authenticode signing. We would like to use the same public key in the strong name as that used in our Authenticode. But, apparently, there is no way to do that. And apparently there is no benefit from doing so.


    Is our only option to generate a strong name from a random key pair?



    Saturday, December 8, 2007 9:07 PM