Programmatically sign Excel VBA macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

My goal is to programmatically sign an Excel VBA macro.

I have a certificate.

I have code to programmatically create an Excel macro.

Word 2002 has access to the Office SignatureSet collection
(ActiveDocument.Signatures which prompts the user to select a certificate via
the Add method of the SignatureSet collection, which is an interface--not a
class--in the Office Interop PIA). Excel does not have a get_Signatures. Why
not?! Who cares, I don't want to prompt the user to identify a certificate
from the store anyway.

Now, I'm thinking, if I had something like SignCode.exe from the "bin" in
the .NET SDK. But signcode.exe wants to sign things with assembly manifests,
not my VBA project. However, I run Microsoft Visual Studio 6.0 Tool
depends.exe on signcode.exe and I see cryptui.dll. Maybe cryptui.dll's
CryptUIWizDigitalSign can help me, but I intuit it might be another dead end.

Is it possible to programmatically sign an Excel VBA macro?
 
As you mentioned, signcode.exe and CryptUIWizDigitalSign (which is the
API that signcode.exe calls) only work on PE's (exe, dll, ocx) and
CABs. Though I'd guess it's probably not as "clean" a solution as what
you had in mind, you could put the macro in a CAB or self-extracting
ZIP file (which is an EXE) and sign that.
 
Back
Top