How to create Key Pair?

 Posted by Abhisek on 1/21/2010 | Category: .NET Framework Interview questions | Views: 3974

You can create a key pair using the Strong Name tool (Sn.exe). Key pair files usually have an .snk extension. To create a key pair at the command prompt, type the following command:
sn k

In this command, file name is the name of the output file containing the key pair. The following example creates a key pair called myKey.snk.
sn -k myKey.snk

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Posted by: chpurnima-3216 on: 2/4/2010
I dont no what the word "Keypair" sounds ? if it really related to strong name then my answer is:

1. Strong name is similar to GUID (It is supposed to be unique in space and time) in COM Components
2. Strong name is only needed when we need to deploy assembly in GAC.
3. Strong name helps GAC to differentiate between two versions of an assembly
4. Strong names use public key cryptography (PKC) to ensure that no one can spoof it. PKC uses public key and private key concept
5. Steps to generate a strong name and sign an assembly:
a. Go to “visual studio command prompt”
b. Type sn.exe –k “C:\test.snk”
c. Signing the project with this snk file
i. In visual studio, click on project ->
ii. Select signing
iii. Click on “use a key file” and browse the snk file to the respective folder
iv. Compile the project

Note: You can view .snk file with note pad

Login to post response