[PR #415] [MERGED] Add signature file for VBA projects (2nd try) #488

Closed
opened 2026-05-05 12:17:13 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/jmcnamara/libxlsxwriter/pull/415
Author: @HolgiHo
Created: 9/18/2023
Status: Merged
Merged: 9/20/2023
Merged by: @jmcnamara

Base: mainHead: add_vba_signature


📝 Commits (3)

  • 1d80620 add support for adding VBA project signatures:
  • a744934 - replace workbook_add_vba_project_signature by workbook_add_signed_vba_project accepting VBA project file plus signature file
  • a733212 - packager: add signature specific files/contents if workbook->vba_project_signature is set

📊 Changes

9 files changed (+212 additions, -5 deletions)

View changed files

📝 docs/src/working_with_macros.dox (+25 -0)
📝 include/xlsxwriter/workbook.h (+31 -1)
📝 src/packager.c (+85 -2)
📝 src/workbook.c (+38 -2)
test/functional/src/images/vbaProject05.bin (+0 -0)
test/functional/src/images/vbaProject05Signature.bin (+0 -0)
test/functional/src/test_macro04.c (+30 -0)
📝 test/functional/test_vba.py (+3 -0)
test/functional/xlsx_files/macro04.xlsm (+0 -0)

📄 Description

PR for issue #411, 2nd try.

Library changes:

  • workbook: new API function workbook_add_vba_project_signature
  • packager: copy vbaProjectSignature.bin, create vbaProject.bin.rels

Tests:

  • new functional test test_macro_signed

Examples:

  • add examples/macro_signed.c
  • fix examples/vbaProject.bin: Was corrupted; now the button press works again; VBA project is signed by "VBA Code Signing"
  • add examples/vbaProjectSignature.bin: The digitial signature, based on "VBA Code Signing" certificate

Utilities for testing the VBA project is signed correctly:

  • new directory dev/vba_code_signing containing:
    • the "VBA Code Signing" certificate certificate.pfx that was used to sign the VBA project file. This certificate is self-signed and only for testing purposes. The password for the private key is "xlsxwriter". In reality, you would obtain a code signing certificate from an offical Certificate Authority. This process is usually quite complex and expensive.
    • PowerShell scripts for creating, exporting, and importing VBA code signing certificates. Execute import_certificate.ps1 to install certificate.pfx on your computer to test the example VBA project is actually signed in Excel.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/jmcnamara/libxlsxwriter/pull/415 **Author:** [@HolgiHo](https://github.com/HolgiHo) **Created:** 9/18/2023 **Status:** ✅ Merged **Merged:** 9/20/2023 **Merged by:** [@jmcnamara](https://github.com/jmcnamara) **Base:** `main` ← **Head:** `add_vba_signature` --- ### 📝 Commits (3) - [`1d80620`](https://github.com/jmcnamara/libxlsxwriter/commit/1d80620a8cfe43b50433ac9d772ecaf02c509f91) add support for adding VBA project signatures: - [`a744934`](https://github.com/jmcnamara/libxlsxwriter/commit/a74493405895f5d43bd4da2dd3b29c725a47f5dd) - replace workbook_add_vba_project_signature by workbook_add_signed_vba_project accepting VBA project file plus signature file - [`a733212`](https://github.com/jmcnamara/libxlsxwriter/commit/a7332129907d4d85e196567413875472abbc3860) - packager: add signature specific files/contents if workbook->vba_project_signature is set ### 📊 Changes **9 files changed** (+212 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `docs/src/working_with_macros.dox` (+25 -0) 📝 `include/xlsxwriter/workbook.h` (+31 -1) 📝 `src/packager.c` (+85 -2) 📝 `src/workbook.c` (+38 -2) ➕ `test/functional/src/images/vbaProject05.bin` (+0 -0) ➕ `test/functional/src/images/vbaProject05Signature.bin` (+0 -0) ➕ `test/functional/src/test_macro04.c` (+30 -0) 📝 `test/functional/test_vba.py` (+3 -0) ➕ `test/functional/xlsx_files/macro04.xlsm` (+0 -0) </details> ### 📄 Description PR for issue #411, 2nd try. Library changes: - `workbook`: new API function `workbook_add_vba_project_signature` - `packager`: copy `vbaProjectSignature.bin`, create `vbaProject.bin.rels` Tests: - new functional test `test_macro_signed` Examples: - add `examples/macro_signed.c` - fix `examples/vbaProject.bin`: Was corrupted; now the button press works again; VBA project is signed by "VBA Code Signing" - add `examples/vbaProjectSignature.bin`: The digitial signature, based on "VBA Code Signing" certificate Utilities for testing the VBA project is signed correctly: - new directory `dev/vba_code_signing` containing: - the "VBA Code Signing" certificate `certificate.pfx` that was used to sign the VBA project file. This certificate is self-signed and only for testing purposes. The password for the private key is "xlsxwriter". In reality, you would obtain a code signing certificate from an offical Certificate Authority. This process is usually quite complex and expensive. - PowerShell scripts for creating, exporting, and importing VBA code signing certificates. Execute `import_certificate.ps1` to install `certificate.pfx` on your computer to test the example VBA project is actually signed in Excel. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror 2026-05-05 12:17:13 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/libxlsxwriter#488
No description provided.