Building Assemblies with VB.Net - How to Build a Strong Name Assembly
(Page 2 of 3 )
An assembly is said to have a strong name when it has a public key and a digital signature. This protects the assembly from being tampered with.
The first step to building an assembly with a strong name is to get a pair of public-private key pair. The public key is written into the physical image of the assembly. The private key is used to generate digital signatures. The key is generated using the .NET framework strong name utility, SN.exe, by specifying the –k switch and the target key file from the command line.
SN.exe –k keyfilename.snk
This key file can be used by several different assembly projects.
The next step is to add the following code at the top of one of the source files in a project:
Imports System.Reflection
<Assembly:AssemblyVersion(“1.0.24.0”)>
<Assembly:AssemblyKeyFile(“..\..\Keyfilename.snk”)>
When the project is built, an assembly with a strong name is generated. The compiler records the full 128 byte value into the manifest of the assembly file it outputs. The compiler uses the private key to generate the digital signature.
Next: Signing of the Assembly and Preventing Tampering >>
More VB.Net Articles
More By Shekar Krishna