This article discusses how to build assemblies and secure them from being tampered with. Every assembly built using the .NET compiler has a four-part name consisting of the following elements:
Friendly name
Version number
Culture setting
Public key or public key token
The first part is a friendly name Like MyAssembly.
The second part is the version number say 1.0.5.0. These four numbers represent the major version, minor version, build number, and revision number respectively. The assembly can be built with a specific version number by placing the following code at the top of any of the project source files:
The AssemblyVersion attribute is defined in the System.Reflection namespace. If no version number is specified, the compiler assigns a version number of 0.0.0.0.
The third part is the culture setting indicating that the assembly has been localized for a particular spoken language.
The fourth, and the last, part of an assembly name is the public key. This value is unique and represents a particular company or developer . Two companies should never use the same public key. The public key occupies 128 bytes and is stored as a binary format in a key file. It can also be written using a text based hexadecimal format as shown below:
Because the public key is so large, a smaller 8 byte value, known as a public key token, is used in its place. The public key token is usually represented by a 16-character hexadecimal string value that looks like this:
A9 FA E6 01 40 67 F5 F1
There is a one to one correspondence between a public key value and a public key token -- i.e.: for a specific public key token there is exactly one corresponding public key value.