Had some fun today with code signing some macro’s in Excel. Applying a code signing certificate is very easy, simply go to the visual basic editor, tools->Signing and you’re away. The problem is creating the correct type of certificate in the first place.
My sys admins provided with a p7b certificate. So I installed that, but it didn’t show in VBs available certificates. So I thought I’d better try and understand what was going on. It turns out that although I need a pfx certificate and a p7b, that it is just part of formula for creating such a beast. You need the private key used to create the original certificate together with the p7b;
pvk2pfx -pvk privateKey.pvk -spc codeSignCert.p7b -pfx actualCodeSign.pfx -po myPassword -f
That will challenge you for the password used to create the original certificate but will produce required pfx file. Now just install that and it should be available for signing