Excel VBA Signing

Today I experienced a strange issue signing Excel VBA code.

Problem

From the VBA editor, when you choose your certificate through Tools\Digital Signature. Ecel would complain about not having any valid signing certificates. However there was one issued by our corporate PKI.

Cause

The cause of this problem, was due to the fact that Windows had two entries in the personal certificate store (certmgr.msc). One of the entries was the Public Key only. The other was the Public + Private key bundle.

Excel must during its certificate enumeration process read the Public Key only certificate. Determine it has no private key, then move onto the key bundle and determine that the public component is the same as what was already evaluated as invalid for signing.

This issue can occur by importing all the certificates provided in the .zip from your nominated registrar. You should only ever need to import the single certificate that contains the Public and Private keys. You should not need to install the Root certificate that comes with your certificate bundle. If you paid for a trusted certificate then it should already be trusted by Windows.

Resolution

Delete any certificates entries that do not contain a private key and share the same public key information as your code signing certificate.

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 )

Google photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s