<p>I have a solution consisting of five projects, each of which compile to separate assemblies. Right now I'm code-signing them, but I'm pretty sure I'm doing it wrong. What's the best practice here?</p>

<ul>
<li>Sign each with a different key; make sure the passwords are different</li>
<li>Sign each with a different key; use the same password if you want</li>
<li>Sign each with the same key</li>
<li>Something else entirely</li>
</ul>

<p>Basically I'm not quite sure what "signing" does to them, or what the best practices are here, so a more generally discussion would be good. All I really know is that <a href="http://en.wikipedia.org/wiki/FxCop" rel="noreferrer">FxCop</a> yelled at me, and it was easy to fix by clicking the "Sign this assembly" checkbox and generating a .pfx file using Visual Studio (2008).</p>

[{'answer_id': 35384, 'author': 'Jim McKeeth', 'author_id': 255, 'author_profile': 'https://Stackoverflow.com/users/255', 'pm_score': 6, 'selected': True, 'text': '<p>If your only objective is to stop FxCop from yelling at you, then you have found the best practice.</p>\n\n<p>The best practice for signing your assemblies is something that is completely dependent on your objectives and needs.  We would need more information like your intended deployment:</p>\n\n<ul>\n<li>For personal use</li>\n<li>For use on corporate network PC\'s as a client application</li>\n<li>Running on a web server</li>\n<li>Running in SQL Server</li>\n<li>Downloaded over the internet</li>\n<li>Sold on a CD in shrink wrap</li>\n<li>Uploaded straight into a cybernetic brain</li>\n<li>Etc.</li>\n</ul>\n\n<p>Generally you use code signing to verify that the Assemblies came from a specific trusted source and have not been modified.  <strong><em>So each with the same key is fine.</em></strong>  Now how that trust and identity is determined is another story.</p>\n\n<p><strong>UPDATE:</strong>  How this benefits your end users when you are deploying over the web is if you have obtained a <a href="http://www.thawte.com/code-signing/index.html?click=main-nav-products-codesigning" rel="noreferrer">software signing certificate from a certificate authority</a>.  Then when they download your assemblies they can verify they came from <em>Domenic\'s Software Emporium</em>, and they haven\'t been modified or corrupted along the way.  You will also want to sign the installer when it is downloaded.  This prevents the warning that some browsers display that it has been obtained from an unknown source.</p>\n\n<p>Note, you will pay for a software signing certificate.  What you get is the certificate authority become the trusted 3rd party who verifies you are who you say you are.  This works because of a web of trust that traces its way back to a root certificate that is installed in their operating system.  There are a few certificate authorities to choose from, but you will want to make sure they are supported by the root certificates on the target operating system.</p>\n'}, {'answer_id': 35388, 'author': 'Martin Clarke', 'author_id': 2422, 'author_profile': 'https://Stackoverflow.com/users/2422', 'pm_score': 2, 'selected': False, 'text': '<p>Signing is used to uniquely identify an assembly. More details are in <em><a href="http://msdn.microsoft.com/en-us/library/ms247123%28VS.80%29.aspx" rel="nofollow noreferrer">How to: Sign an Assembly (Visual Studio)</a></em>.</p>\n\n<p>In terms of best practice, it\'s fine to use the same key as long as the assemblies have different names.</p>\n'}, {'answer_id': 35403, 'author': 'Martin Clarke', 'author_id': 2422, 'author_profile': 'https://Stackoverflow.com/users/2422', 'pm_score': 2, 'selected': False, 'text': "<p>It helps because the executable is expecting a strongly named assembly. It stops anyone maliciously substituting in another assembly for one of yours. Also the user might grant an assembly CAS permissions based on the strong name. </p>\n\n<p>I don't think you should be distributing the .pfx file, you keep that safe for resigning the assembly.</p>\n"}, {'answer_id': 46828, 'author': 'Don Kirkby', 'author_id': 4794, 'author_profile': 'https://Stackoverflow.com/users/4794', 'pm_score': 3, 'selected': False, 'text': '<p>The most obvious difference between signed and unsigned assemblies is in a ClickOnce application. If you don\'t sign it, then users will get a scary "Unknown Publisher" warning dialog the first time they run your application. If you\'ve signed it with a <strong>certificate from a trusted authority</strong>, then they see a dialog that\'s less scary. As far as I know, signing with a certificate you generate yourself doesn\'t affect the "Unknown Publisher" warning. <a href="http://www.instantssl.com/code-signing/code-signing-technical.html" rel="noreferrer">Instant SSL from Comodo</a> has examples of the dialogs.</p>\n\n<p>There are some subtler differences. You have to sign an assembly before it can be installed in the global assembly cache (GAC) where it can be shared by multiple applications. Signing is integral to code access security (CAS), but I haven\'t found anyone who could get CAS working. I\'m pretty sure that both the GAC and CAS work fine with certificates you generate yourself.</p>\n'}, {'answer_id': 56119, 'author': 'koregan', 'author_id': 5752, 'author_profile': 'https://Stackoverflow.com/users/5752', 'pm_score': 2, 'selected': False, 'text': '<p><strong>It is important to keep your PFX file secret as it contains the private key.</strong></p>\n\n<p>If that key is made available to others then anyone can sign assemblies or programs that masquerade as you.</p>\n\n<p>To associate your name with your assemblies (in the eyes of Windows) you\'ll need to get a digital certificate (the portion of the PFX file containing your name) signed by a trusted authority.</p>\n\n<p>Actually you\'ll get a new certificate, but with the same information.</p>\n\n<p>You\'ll have to pay for this certificate (probably annually), but the <a href="https://en.wikipedia.org/wiki/Certificate_authority" rel="nofollow noreferrer">certificate authority</a> will effectively vouch for your existence (after you\'ve faxed them copies of your passport or driver\'s permit and a domestic bill).</p>\n'}]
['https://Stackoverflow.com/questions/35373', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3191/']