Microsoft Authenticode / Code signing

Started by
5 comments, last by Ectara 12 years ago
Hi!

For work, we are looking at signing our executables so that they can be verified and don't generate warnings for our users. Does anyone have experience with this? Our application is written in C# and uses the .NET 4 Client Profile framework. From what I understand, this code signing technique is called Authenticode..? Is that also the tech used so sign .NET assemblies?

I also understand that I need a certificate for this signing to really mean something. The first provider (CA that is) we found was Verisign.com, which is well known and therefore seemed like a good choice. However, it talks about ActiveX controls and appears to lock the key files to a specific system.. Does anyone know how that works? How do I use it once I have a certificate?
Advertisement
This is what is used for signing both native and .NET exes/dll files: http://msdn.microsoft.com/en-us/library/8s9b9yaz(v=vs.80).aspx

Unfortunately I am not too sure how the actual certificate is obtained, or what kind of certificate you should ask them for. But I do know that it can be obtained From Verisign, but that we switched to someone else I can't remember, because it cost less.

I do know things about signatures from a technical perspective, so if you have specific questions, just ask.

I can share one curious thing I have found out that made me scratch my head for a while, before I realized what was going on:
The application was on a machine without connection to the internet. It froze for (i think) 60 seconds when launched. And only when the files were signed...

It turns out that counter-signed (signed with timestamp) .NET-assemblies attempt to validate the signature online when loaded. To avoid this, they can be signed without timestamp. Native DLLs do not exhibit this behaviour, even if signed with timestamp.

Setup files (exe, msi, cab) should be signed with timestamp. They work fine in all current versions of Windows without it, but Windows 8 seems to treat them as "unknown publiher" if they are not signed with timestamp.

Does anyone know how that works? How do I use it once I have a certificate?


Once you have a cert, you should be able to generate a key for code signing from it. Don't know specifically how that works; should just be an export option.

Signing code can be done in the properties for the project. There's a signing tab, then you just need to specify the strong name key file (.snk). If you're using click once, that uses a different type of cert (.pfx)
We use obfuscation from DotFuscator, so I assume I can't use the VS project setting..?
Remember that it can cause confusion that there are two different ways (that are completely unrelated) to sign assemblies. Using an snk file in the project options is called "strong name assemblies". This has nothing to do with the level of trust placed in the assembly, it's just a way of making sure the assembly "name" is unique. This is not what you want, if I understand your request properly.

If you want digital signatures with trust (and from your first post I gather that you do), you need to use a certificate obtained from someone like Verisign and use it with the tool linked in my previous post.
Most likely no. I presume that the project setting just maps to a compiler flag; the basic idea should hold.
If anyone can sign their own applications from within the IDE through a compiler flag, may whatever deity save the poor soul that puts trust in signed applications.

It sounds like you need a certificate from an authority like Verisign.

This topic is closed to new replies.

Advertisement