VBA signing Open office

May 25, 2018 in Windows and Code Signing

Signing Open Office 2.0 Macros with a Sectigo Code-Signing Certificate.

This document details the process to sign Microsoft Office 2000 & XP VBA macros with a Sectigo Code-Signing certificate.
All web links are provided for illustration purposes only. It is recommended that the user checks for any updates that may become available since the publishing of this document.

Prerequisites:

  • Microsoft's tool to import PVK files:


Download the PVK import tool from Microsoft (pvkimprt.exe)

  • Your code signing certificate from Sectigo (as PVK and SPC files).


Preparation:


Procedure:

  1. Install pvkimport you downloaded from Microsoft. Remember the paths to where you installed it (c:\\codesign\\).
  2. You may also copy your certificate/key files to this directory (mycert.spc & mykey.pvk).
  3. Open a command-prompt and change to the folder where you installed pvkimport. (c:\\codesign\\).
  4. Combine your SPC and PVK certificate/key files that you received from Sectigo into a PFX file using
    • pvkimport: (c:\\codesign> pvkimprt -import –pfx c:\\codesign\\mycert.spc c:\\codesign\\mycert.pvk)
      • This will start a wizard.
      • Choose options:
      • Yes, Export the Private Key (check)
      • Include all Certificates in Path if possible (check)
      • Enable strong protection (uncheck)
      • Delete the private key if export is successful (uncheck)
      • Enter a password
      • Choose a location (c:\\firefoxext\\mycert.pfx)
      • 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. Opening your code signing certificate should show code signing usage and that you have the private key.
  6. Within your Open Office 2.0 document, open the macro editor from the Tools – Macro menu and generate your macro.
  7. To sign the document macro, select Digital Signature from the Tools – Macro menu.
  8. Select Add to chose to open up Select Certificate window.
  9. Select your code-signing certificate
  10. Click OK to sign your document macro.
  11. Click OK once again.
  12. Your document macro is now digitally signed.