Hi Friends,
We all have seen the PublicKeyToken in the web.config file. Most of the begineers will assum that "When we sign the assambly, it will have PublicKeyToken for the signed it. And the PublicKeyToken is the public key for the assambly." Well this is not true.
We all know that we can sign an assambly with .snk file. For those who don't know how to generate a sign key, you can generate a new key with sn.exe tool shipped with Visual Studio.
Now the .snk file contains PublicKey and a PrivateKey for the assambly to encrypt/decrypt the data.
Now the actual PublicKey is a 128 byte opaque algorithm specific structure. It also have extra 32 byte data for headers.
Now the question is, if PublicKey is 128 + 32 bytes then why we write only 16 characters for PublicKeuToken in web.config. What is the difference between PublicKey and PubilcKeyToken.
PublicKeyToken is a 8 byte hash for the full PublicKey.
Most of compilers use this token instead of full PublicKey to keep the assembly's manifest smaller.
Hope this information will be helpful to all.
Best
Nirav
A blog where you can find tutorials on ASP.Net, Ajax Control Toolkit, SQL Server 2008/2005, WCF, Silverlight, Azure and other Microsoft Technologies
Sunday 23 May 2010
1 comments:
Comments posted on ASP.Net Ajax Tutorials Blog are moderated and will be approved only if they are on-topic and not abusive. Please email me or my team for tech-support or blogging related questions. Avoid including website URLs in your comments - Thanks Author
Subscribe to:
Post Comments (Atom)
Nice comparison..... i like such comparisons..
ReplyDeleteThank you for sharing...Joomla Toronto