Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to dual sign a dll with a certificate?

We need to sign a dll file with SHA1 & SHA2 (to obtain prior to Win XP SP3 signing cert with SHA1 and post Win XP SP3 OS's with highest security of SHA2). I found an article that says to do something like the below, but I can't get it to work (show 2 certs in Win 8). For an example of what I mean by a dual signed dll, look at the certificate of the System.Data.dll in the .NET framework 4.0 in Windows 8, and you'll see a SHA1 & SHA2 certificate in the properties window.

Signtool sign /fd sha256 /ph /as /sha1 XX...XX $(TargetPath)

http://msdn.microsoft.com/en-us/library/windows/hardware/hh967734(v=vs.11).aspx

Does anyone know how to do this? Thanks! -jp

like image 284
Japster24 Avatar asked Jun 05 '13 15:06

Japster24


People also ask

How do I sign a DLL certificate?

To sign your add-in with your own certificate, you first need to purchase a digital signature from a digital certificate vendor. Once you obtain a certificate (cer) or Personal Information Exchange (pfx) file, you can sign your DLL(s) using signtool.

Do DLL need to be signed?

It is a recommended secure practice to sign all binaries that you ship and validate their signatures at runtime. If your dlls are to be used by other products then you must sign them as those products will want to verify their authenticity and integrity.


2 Answers

I figured this out. Below is how you do this. Hope this helps someone else out:

signtool sign /fd sha1 /f sha1cert.pfx /p password file.dll
signtool sign /as /fd sha256 /f sha2cert.pfx /p password file.dll

*have to use at least a VS2012 developer command prompt for SHA2 signing

like image 189
Japster24 Avatar answered Nov 15 '22 23:11

Japster24


Key point is using the /as switch on the secondary sign step to "append signature". If you don't include that, it'll just overwrite the first signature.

like image 33
Benjamin_FTW Avatar answered Nov 15 '22 23:11

Benjamin_FTW