blogs.conchango.com

welcome to the conchango blogging site
Welcome to blogs.conchango.com Sign in | Join | Help
in Search

Stuart Preston's Blog

Mostly about Visual Studio Team System, Team Foundation Server, Engineering Practices and Application Lifecycle Management.

Automating signtool.exe (or how to make a PFX file from a PVK and SPC file!)

It is often desirable to automate the process of using signtool.exe to digitally sign compatible files (for example .cab, .msi, .exe, .dll, .ocx) for distribution. 

If you signed up with a certificate provider such as Verisign and went through the somewhat tedious but necessary verification exercise, you'll probably have found yourself left at the end of things with a private key (extension .pvk) and a set of certificates they supplied (extension .spc).

Rather than having to import these certificates into the local store on each machine you need to do a build on, signtool.exe can work with a single PFX file which is a complete certificate store (including the private key).

To create the PFX file, all you need is the PVKIMPRT.exe tool which you can download from here: http://www.microsoft.com/downloads/details.aspx?FamilyID=F9992C94-B129-46BC-B240-414BDFF679A7&displaylang=EN

Simply run the tool as follows:

pvkimprt.exe -pfx <yourspc.spc> <yourpvk.pvk>

A dialog will popup asking for the password to the private key, and finally lets you select the output filename.

You are now ready to use signtool.exe at the command line with the "sign" switch (instead of "signwizard").  Assuming you want to digitally sign and timestamp MyInstaller.msi with MyPfxFile.pfx, the command line would be something like this:

signtool.exe sign /f MyPfxFile.pfx /p MyPrivateKeyPassword /d "My Product Name" /du "http://www.myproducturl.com" /t "http://timestamp.verisign.com/scripts/timestamp.dll" "MyInstaller.msi"
  

Published 19 February 2007 08:13 by Stuart.Preston

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

TrackBack said:

May 14, 2007 17:59
 

TrackBack said:

May 14, 2007 17:59
 

Husker said:

you can also use pvk2pfx.exe instead if pfximprt.exe http://msdn2.microsoft.com/en-us/library/bb172338.aspx
June 20, 2007 12:58
 

Buspar addiction. said:

Buspar xanax.

July 31, 2008 01:29
 

Effexor xr 37.5 when will it start working. said:

Effexor xr. Effexor side effects. Effexor. Effexor withdrawal. Can u feel effexor xr work aftera few days. Effexor serious side effects.

August 6, 2008 22:17

Leave a Comment

(required) 
(optional)
(required) 
Submit
Powered by Community Server (Personal Edition), by Telligent Systems