Digitally code signing Office VBA macro

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

One thought on “Digitally code signing Office VBA macro

  1. vino November 18, 2010 / 10:48 pm

    Your comment really saved my time.. Thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s