views:

273

answers:

2

I'm creating a starter kit that installs the compiled assemblies from an open-source project into the GAC to make it easier to reference the assemblies in the template. Since they're going in the GAC, they need to be signed.

Do I need to password protect and secure the key file, or is it okay to leave it open and include the file in source control?

+2  A: 

Strong name signing has several purposes (though not for actual protection against tampering with the program, as is common misconception) - in your case the usage of a strong key for uniquely identifying (and verifying) a specific version of a specific assembly, which is required by the GAC. The other usage, which is preventing spoofing by other assemblies, doesn't seem necessary in this case (correct me if I'm wrong). For this reason, I would believe that it's perfectly acceptable to leave the key open (not password protected) and include the file in source control. As far as I can see, you're not going to stop anything you don't want by password protecting the key. (However, if you could provide more detail on the security context, I might have to revise that view.)

Also, see this MSDN article for a great thorough discussion of how to properly use strong name signing in general.

Noldorin
Could you elaborate on that misconception about protection against tampering an assembly? This seems not correct to me (see http://stackoverflow.com/questions/369248/can-strong-naming-an-assembly-be-used-to-verify-the-assembly-author/369477#369477), but maybe I am missing something? However, with a strong name alone it is obviously not possible to verify the authority (that would need a certificate mechanism such as Authenticode).
0xA3
@divo: What isn't correct, exactly? The problem with strong key signing is that you can't verify the source of the public key, so that it can be regenerated by another author and still agree with the assmebly (which can then be tampered). If you think that the linked answer disagrees with mine (I'm confident it doesn't), then try rereading it carefully (in conjunction with Mehrdad's answer, which is also good). There are a few subtleties here that are by no means easy to understand.
Noldorin
+1  A: 

I would say include a 'development' key in source control, to make building easier and avoid forcing people to faff around with creating and using their own key. The key in source control is meaningless security-wise, since anyone can sign with it. If people want to sign their build of your open-source project, they can substitute their key which they can manage any way they like.

You could also provide builds for download, signed with a secured key (that you don't give anyone), but for people to want to use these binaries they would need to trust you. Are you trustworthy? :)

mackenir