Digi-Sign, The Certificate Corporation
Published on Digi-Sign, The Certificate Corporation (http://www2.digi-sign.com)

Home > VBA signing Office 2k & XP VBA Macros

By Digi-Sign
Created Feb 20 2008 - 15:53

VBA signing Office 2k & XP VBA Macros

Signing Microsoft Office 2k & XP VBA Macros with a Digi-Sign Digi-Code™

This document details the process needed to sign Microsoft Office 2K & XP VBA macros with a Digi-Sign Digi-Code™ certificate including a worked example. All web links are provided for illustration purposes only, and are correct at time of publishing. It is recommended that the user checks for any updates that may become available since the publishing of this document.

Pre-requisites:

  • Microsoft's tool to import PVK files:
  • http://www.microsoft.com/downloads/details.aspx?familyid=F9992C94-B129-4... [1]
    (pvkimprt.exe)

  • Your code signing certificate from Digi-Sign (as PVK and SPC files).

Preparation:

Download the PVK import tool from Microsoft (pvkimport.exe).
http://www.microsoft.com/downloads/details.aspx?familyid=F9992C94-B129-4... [1]

Obtain your code signing certificate from Digi-Sign here.

Procedure:

    1. Install pvkimport you downloaded from Microsoft. Remember the paths to where you installed it (c:\codesign\). You may also copy your certificate and key files to this directory (mycert.spc & mykey.pvk).

    2. Open a command-prompt and change to the folder where you installed pvkimport. (c:\codesign\).

    3. Combine your SPC and PVK certificate/key files that you received from Digi-Sifn into a PFX file using pvkimport: (c:\codesign> pvkimprt –pfx c:\codesign\mycert.spc c:\codesign\mycert.pvk)
    This will start a wizard.

    Enter a password [PIN Code]
    Choose options:

    • Yes, Export the Private Key (check) and click Next
    • Include all Certificates in Path if possible (check) and click Next
    • Re-enter the password [PIN Code] and click Next
    • Choose path and file name (c:\codesign\mycert.pfx) and click Next
    • Click Finish.

    4. Install your Digi-Code™ certificate in Windows registry.

    • Locate the saved PFX file using your favourite file browser
    • Double click the PFX file
    • Follow the installation wizard
    • Enter a password [PIN Code]
    • Clinck Next and Finish

    5. You can check the private key has been imported successfully by using MMC. Open MMC, select add/remove snap in and select certificates for your personal certificate store. Opening your code signing certificate should show code signing usage and that you have the private key corresponding to the certificate.

    6. Within your MS Office document, open the Visual Basic editor from the Tools – Macro
    menu.

    7. Open the VBA project you wish to sign, and select Digital Signature from the Tools menu.

    8. Select Chose from the Digital Signature window and choose your code signing certificate that you
    wish to use to sign your VBA macro.

    9. Click OK followed by Save, close to return to your Office document. Your macro is now digitally signed.


  • Digi-Code™

Source URL: http://www2.digi-sign.com/support/digi-code/vba

Links:
[1] http://www.microsoft.com/downloads/details.aspx?familyid=F9992C94-B129-46BC-B240-414BDFF679A7&displaylang=en