Alex Rivera | Logout

What does digital signature have to do with strong named assemblies?

Asked 2009-08-26T13:18:59.570
27

What does digital signature have to do with strong named assemblies? I read that a strongly named assembly has public key and digital signature with it.

From the Wikipedia article "Assembly (CLI)":

"Signing the assembly involves taking a hash of important parts of the assembly and then encrypting the hash with the private key. The signed hash is stored in the assembly along with the public key. The public key will decrypt the signed hash. When the CLR loads a strongly named assembly it will generate a hash from the assembly and then compare this with the decrypted hash. If the comparison succeeds then it means that the public key in the file (and hence the public key token) is associated with the private key used to sign the assembly. This will mean that the public key in the assembly is the public key of the assembly publisher and hence a spoofing attack is thwarted."

Is the above info accurate? It doesn't have any reference to digital signature. I couldn't find an MSDN page explaining how assemblies are signed, how signature is verified and how possibility of hacking is eliminated. I would like to know more on these; I'd like to have an overall idea how it works.

Edit
Report

2 Answers

54

Both strong naming and digital signatures use public key cryptography to provide evidence about the origin of an assembly, so that you can apply security policy to determine what permissions are granted to the assembly.

They differ not in their technical details, but in what problems they are intended to solve.

The purpose of a strong name is solely to ensure that when you load an assembly by name, you are loading exactly the assembly you think you are loading. That is the only by-design purpose of a strong name. You say "I want to load Frobber, version 4, that came from FooCorp". The strong name gear ensures that you actually load precisely that DLL, and not another assembly called Frobber, version 4, that came from Dr. Evil Enterprises.

In order to achieve this, all that is required is that you know the public key token associated with FooCorp's private key. How you come to know that public key token is entirely your business. There is no infrastructure in place designed to help you get that information safely. You're just expected to know what it is, somehow.

The purpose of a digital signature from a publisher certificate is to establish a verifiable chain of identity and trust. The chain of trust goes from a hunk of code of unknown or uncertain origin up to a "trusted root" -- an entity which you have configured your operating system to trust. You download some code, and the code has a digital signature with a certificate from FooCorp. You examine the certificate and it says "this program comes from FooCorp. The accuracy of this certificate is vouched for by VeriSign." Since VeriSign is one of your trusted roots, you now have confidence that this code actually did come from FooCorp.

Notice how much more complex the problem solved by digital signatures is. We're not

answered 2009-08-26T16:45:01.230
2

The digital signature is essentially the bit that prevents tampering. Once the assembly is signed, then any changes to will invalidate the signature and the clr will know not to load it.

Read the wikipedia article. Digital signatures prevent tampering of any digital document. Not just assemblies. It explains it way better then I ever could.

answered 2009-08-26T13:24:23.213

Your Answer