Saturday, April 23, 2005
by Nik Kalyani
Saturday, April 23, 2005 5:31:40 PM (Pacific Standard Time, UTC-08:00)

If you wish to create strong named assemblies in .Net, you need to sign them. This is done using a key that you reference through the project’s AssemblyInfo.cs or AssemblyInfo.vb file. There are three attributes related to signing:

[assembly: AssemblyDelaySign(false)] Used to allow signing of the assembly with only the public key. This allows the assembly to be used during development without having to share the private key.

[assembly: AssemblyKeyFile("")] Used to specify the path to a key file.

[assembly: AssemblyKeyName("")] Used to specify the name of a key to use from the Crypto Service Provider (CSP).

If you are going to sign all your assemblies, then the AssemblyKeyName is the best option as it does not require you to remember a path to the key file each time you create a new project. It’s much easier to remember a simple name associated with the key. Here’s how you would sign an assembly using the CSP:

1) Generate a key pair:  sn -k MyCompany.snk

2) Install into the CSP:  sn -i MyCompany.snk MYCOMPANY

3) Use in your code:  [assembly: AssemblyKeyName(“MYCOMPANY”)]

#    Comments [2] - Trackback    

ASP.Net

Tracked by:
"phentermine" (phentermine) [Trackback]
RSS feed
Search and Links
Bling

View Nik Kalyani's profile on LinkedIn

Contact me: nik*kalyani.com (replace "*")

TechBubble
www.flickr.com
This is a Flickr badge showing public photos from techbubble. Make your own badge here.
Statistics
Total Posts: 213
This Year: 31
This Month: 8
This Week: 0
Comments: 235
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008
Nik Kalyani
Sign In
All Content © 2008, Nik Kalyani