Sunday, October 14, 2007

Generating KeyPair using SN.EXE

The Strong Name tool helps to sign assemblies with strong names. SN Stands for Strong Name
The Strong Name Consists of the Assembly Identification like Assembly Name ,Version ,Culture ,Public Key, and digital signature

The Public Key can be generated by using the .Net Framework tool (SN.EXE).

The key pair generated can be used for different assembly
The Strong name solves the versioning problem and naming problem
The user can deploy an assembly with the same name and same key pair in the GAC just by changing the version number

The simple syntax to generate strong name
Go to visual studio 2003 Command prompt and type the following command to generate the Key pay

Sn – K C:\Strongname.snk
When you type enter the strong name file will be generated in the specified location
To export the key from 1 file format to another
Sn – o C:\Strongname.snk C:\Strongname.txt
Sn – p C:\Strongname.snk C:\Strongname.txt

To Verify
Sn – v Sample.dll
It will verify for the strong name signature in the assembly if you put –vf instead of –v it’s a force verification

No comments: