Strong Name in .Net

In this blog, I’m trying to explain the concept of strong name in .net

A strong name consists of the assembly's identity—its simple text name, version number, and culture information (if provided)—plus a public key and a digital signature. It is generated from an assembly file (the file that contains the assembly manifest, which in turn contains the names and hashes of all the files that make up the assembly), using the corresponding private key. Visual Studio can assign strong names to an assembly. Assemblies with the same strong name are expected to be identical.

You can ensure that a name is globally unique by signing an assembly with a strong name. In particular, strong names satisfy the following requirements:

  • Strong names guarantee name uniqueness by relying on unique key pairs. No one can generate the same assembly name that you can, because an assembly generated with one private key has a different name than an assembly generated with another private key.
  • Strong names protect the version lineage of an assembly. A strong name can ensure that no one can produce a subsequent version of your assembly. Users can be sure that a version of the assembly they are loading comes from the same publisher that created the version the application was built with.
  • Strong names provide a strong integrity check. Passing the .NET Framework security checks guarantees that the contents of the assembly have not been changed since it was built. Note, however, that strong names in and of themselves do not imply a level of trust like that provided, for example, by a digital signature and supporting certificate.

How to create Strong Name:

  1. Open Visual Studio Command Prompt
  2. Write this code C:\>sn –k “D:\ [FolderName]\ [StrongKeyName.snk]”, this code will generate key.
  3. After write above code you will see a message on Command Prompt window “key Pair written to D:\[FolderName]\[StrongKeyName].snk” 
  4. If you want to check that Strong Name is created or not, go to  drive that you have passed and you will get Strong Name has created.

Leave Comment