--- title: "Fortanix DSM with Signing Microsoft Visual Basic for Applications (VBA) Projects" slug: "fortanix-dsm-with-signing-microsoft-visual-basic-for-applications-vba-projects" updated: 2026-10-06T08:50:11Z published: 2026-10-06T08:50:11Z canonical: "support.fortanix.com/fortanix-dsm-with-signing-microsoft-visual-basic-for-applications-vba-projects" --- > ## Documentation Index > Fetch the complete documentation index at: https://support.fortanix.com/llms.txt > Use this file to discover all available pages before exploring further. # Fortanix DSM with Signing Microsoft Visual Basic for Applications (VBA) Projects ## 1.0 Introduction This article describes how to sign Microsoft Visual Basic for Applications (VBA) projects using Fortanix-Data-Security-Manager (DSM). Microsoft VBA is available across Microsoft 365 and Microsoft Office desktop applications, including Excel, Outlook, PowerPoint, and Word. VBA extends application functionality and automates repetitive tasks. VBA macros execute code within the Microsoft Office application that hosts the VBA project. Unsigned VBA projects can therefore introduce security risks. Signing a VBA project with a private key stored in Fortanix DSM helps protect code integrity and support compliance requirements. ## 2.0 Prerequisites Ensure the following: - Install the Fortanix CNG provider on the server or workstation used to create the VBA projects. *For information on installing and configuring the CNG provider, refer to* [*CNG/EKM*](https://support.fortanix.com/docs/cng-ekm)*.* - After installing the provider, run the following command to verify that Windows registered it correctly: ```bash certutil -csplist -csp "Fortanix KMS CNG Provider" ``` ![](https://cdn.us.document360.io/c3bd85d2-4ad8-4d85-9f60-f1c168a3aad9/Images/Documentation/fortanix-dsm-with-signing-microsoft-visual-basic-for-applications-vba-projects-image-ba9yeqhl.png?sv=2026-02-06&spr=https&st=2026-11-23T23%3A09%3A18Z&se=2026-11-24T00%3A09%3A18Z&sr=b&sp=r&sig=IQZXoTKGC0Ln4EZx6NvSRGIbCYijYRXsPl%2FrDPQnb78%3D) **Figure 1: certutil output** > [!NOTE] > NOTE > > If you use a 32-bit Windows machine, install the 32-bit Fortanix CNG Provider and run the command from a 32-bit command prompt. - In the Windows registry, add a `DWORD` value named `V1HashEnhanced` under `HKCU\SOFTWARE\Microsoft\VBA\Security` to specify the hash algorithm. Set the value as follows: > [!NOTE] > NOTE > > The default value uses MD5, which is a legacy algorithm that the Fortanix CNG Provider does not support. ![](https://cdn.us.document360.io/c3bd85d2-4ad8-4d85-9f60-f1c168a3aad9/Images/Documentation/fortanix-dsm-with-signing-microsoft-visual-basic-for-applications-vba-projects-image-sj3wqrlv.png?sv=2026-02-06&spr=https&st=2026-11-23T23%3A09%3A18Z&se=2026-11-24T00%3A09%3A18Z&sr=b&sp=r&sig=SEzo2jHKm4%2Bm7e%2BjXdjkGWB19fffCnL5KEvwzJ1w8IA%3D) **Figure 2: V1HashEnhanced registry value set to 2 (SHA-256)** - 1 for SHA-1 - 2 for SHA-256 - 3 for SHA-384 - 4 for SHA-512 ## 3.0 Product Tested Version The following product versions were tested: - Fortanix KMS CNG Provider 5.10.2980 - Fortanix DSM 5.10 version ## 4.0 Configure Fortanix DSM A Fortanix DSM service must be configured, and the URL must be accessible. To create a Fortanix DSM account and group, refer to the following sections: ### 4.1 Signing Up To get started with the Fortanix DSM cloud service, you must register an account at . For example, [https://amer.smartkey.io.](https://amer.smartkey.io.) On-premises customers use the KMS URL, and the SaaS customers can use the URLs as listed [*here*](https://support.fortanix.com/hc/en-us/articles/4406135346068-Fortanix-DSM-SaaS-Global-Availability-Map) based on the application region. *For more information on how to set up the Fortanix DSM, refer to* [*Sign Up for Fortanix Data Security Manager SaaS*](https://support.fortanix.com/docs/users-guide-sign-up-for-fortanix-data-security-manager-saas)*.* ### 4.2 Creating an Account Access in a web browser and enter your credentials to log in to Fortanix DSM. ![A screenshot of a login screen AI-generated content may be incorrect.](https://cdn.us.document360.io/c3bd85d2-4ad8-4d85-9f60-f1c168a3aad9/Images/Documentation/fortanix-dsm-with-signing-microsoft-visual-basic-for-applications-vba-projects-image-2iwqx87f.png?sv=2026-02-06&spr=https&st=2026-11-23T23%3A09%3A18Z&se=2026-11-24T00%3A09%3A18Z&sr=b&sp=r&sig=9HXS64JOjrLP6t50o0W9J1qQjxYtAM9RZbsBQgpeE2E%3D) **Figure 3: Loggin In** *For more information on how to set up an account in Fortanix DSM, refer to* [*Getting Started with Fortanix Data Security Manager - UI*](https://support.fortanix.com/docs/users-guide-getting-started-with-fortanix-data-security-manager-ui)*.* ### 4.3 Creating a Group Perform the following steps to create a group in the Fortanix DSM: 1. In the DSM left navigation panel, click the **Groups** menu item, and then click **ADD GROUP** to create a new group. ![](https://cdn.us.document360.io/c3bd85d2-4ad8-4d85-9f60-f1c168a3aad9/Images/Documentation/fortanix-dsm-with-signing-microsoft-visual-basic-for-applications-vba-projects-image-kexb3691.png?sv=2026-02-06&spr=https&st=2026-11-23T23%3A09%3A18Z&se=2026-11-24T00%3A09%3A18Z&sr=b&sp=r&sig=5vDOrvUGGHZEks9LZJiU9lyzIztSMIFnmRgGrtSQZ00%3D) **Figure 4: Add Groups** 2. On the **Adding new group** page: 1. **Title**: Enter a name for your group. 2. **Description** (optional): Enter a short description of the group. 3. Click **SAVE** to create a new group. The new group is added to the Fortanix DSM successfully. *For more information about groups, refer to* [*Definitions*](/v1/docs/dsm-definitions#40-groups)*.* > [!TIP] > TIP > > It is recommended to configure a **Key undo policy** for groups for the cryptographic keys used by the application before creating or using the keys. Without a configured **Key undo policy**, key deletion is permanent and the deleted key cannot be recovered. Deleting an encryption key may result in permanent loss of access to the protected data and service disruption for applications that depend on the deleted key. *For detailed steps, refer to* [*Key Undo Policy*](/v1/docs/fortanix-dsm-key-undo-policy)*.* ### 4.4 Creating an Application Perform the following steps to create an application (app) in the Fortanix DSM: 1. In the DSM left navigation panel, click the **Apps** menu item, and then click **ADD APP** to create a new app. ![](https://cdn.us.document360.io/c3bd85d2-4ad8-4d85-9f60-f1c168a3aad9/Images/Documentation/fortanix-dsm-with-signing-microsoft-visual-basic-for-applications-vba-projects-image-d1053m8q.png?sv=2026-02-06&spr=https&st=2026-11-23T23%3A09%3A18Z&se=2026-11-24T00%3A09%3A18Z&sr=b&sp=r&sig=0R5VcyBy8nHpW4htIqwmoafsuDnNVZIRI8fq9c2lLCk%3D) **Figure 5: Add Application** 2. On the **Adding new app** page: 1. **App name:** Enter the name for your application. 2. **ADD DESCRIPTION** (optional)**:** Enter a short description of the application. 3. **Authentication method:** Select the default **API Key** as the authentication method from the drop down menu. *For more information on these authentication methods, refer to* [*Authentication*](https://support.fortanix.com/hc/en-us/articles/360033272171-User-s-Guide-Authentication)*.* 4. **Assigning the new app to groups:** Select the group created in [*Section 4.3: Creating a Group*](/v1/docs/fortanix-dsm-with-signing-microsoft-visual-basic-for-applications-vba-projects#43-creating-a-group) from the list. 3. Click **SAVE** to add the new application. *For more information about applications, refer to* [*Definitions*](https://support.fortanix.com/docs/dsm-definitions#50-applications)*.* ### 4.5 Copying the API Key Perform the following steps to copy the API key from the Fortanix DSM: 1. In the DSM left navigation panel, click the **Apps** menu item, and then click the app created in [*Section 4.4: Creating an Application*](/v1/docs/fortanix-dsm-with-signing-microsoft-visual-basic-for-applications-vba-projects#44-creating-an-application) to go to the detailed view of the app. 2. On the **INFO** tab, click **VIEW API KEY DETAILS**. 3. From the **API Key Details** dialog box, copy the **API Key** of the app to use in [*Section 5.0: Configure the Fortanix KMS CNG Provider*](/v1/docs/fortanix-dsm-with-signing-microsoft-visual-basic-for-applications-vba-projects#50-configure-the-fortanix-kms-cng-provider)*.* ## 5.0 Configure the Fortanix KMS CNG Provider Configure the Fortanix KMS CNG Provider on the signing workstation with the required configuration variables. *For information on configuring the Fortanix KMS CNG Provider, including API key-based and certificate-based authentication, refer to* [*Microsoft CNG Key Storage Provider*](https://support.fortanix.com/docs/fortanix-dsm-clients-microsoft-cng-key-storage-provider#60-configuration)*.* ## 6.0 Creating the Private Key and Certificate Create a self-signed or CA-signed certificate for signing the VBA project. The associated private key is securely stored in Fortanix DSM. ### 5.1 Creating a Self-Signed Certificate Perform the following steps to create a self-signed certificate and corresponding private key in Fortanix DSM: 1. Run the following PowerShell command to generate the private key and a self-signed certificate in Fortanix DSM: ```bash $cert = New-SelfSignedCertificate -Subject "VBASignCert" -type codesigningcert -provider "Fortanix KMS CNG Provider" -certstorelocation Cert:\CurrentUser\My ``` This command creates the certificate and stores it in the **Current User** certificate store. 2. Run the following command to verify that the certificate is available in the certificate store: ```bash certutil -store -user My ``` ![](https://cdn.us.document360.io/c3bd85d2-4ad8-4d85-9f60-f1c168a3aad9/Images/Documentation/fortanix-dsm-with-signing-microsoft-visual-basic-for-applications-vba-projects-image-9ujcq84w.png?sv=2026-02-06&spr=https&st=2026-11-23T23%3A09%3A18Z&se=2026-11-24T00%3A09%3A18Z&sr=b&sp=r&sig=BN14OcbSRkNYKirx980zVr6%2BKxreWAOSkHpuF7CFR1k%3D) **Figure 6: Verifying the certificate** This command creates the corresponding private key in Fortanix DSM. ![](https://cdn.us.document360.io/c3bd85d2-4ad8-4d85-9f60-f1c168a3aad9/Images/Documentation/image (1)(2).png?sv=2026-02-06&spr=https&st=2026-11-23T23%3A09%3A18Z&se=2026-11-24T00%3A09%3A18Z&sr=b&sp=r&sig=0k%2B5yZfD7SVKD9bdL%2Bft0a5M8ArjpNa0M8j7Ci6HpSs%3D) **Figure 7: Key created in Fortanix DSM** ### 6.2 Creating a CA-Signed Certificate Perform the following steps to generate a certificate signing request (CSR) by using certreq.exe and submit the CSR to your certificate authority (CA) for signing: 1. In a temporary directory, create a file named `request.inf`. 2. Add the following configuration to the file and update the placeholders as required: ```bash [NewRequest] Subject = "CN=,OU=,O=,C=" KeyContainer = "" ProviderName = "Fortanix KMS CNG Provider" ``` Where, - `Common_Name`: The common name for the certificate. - `Organizational_Unit`: The organizational unit for the certificate. - `Organization`: The organization name. - `Country`: The two-letter country code. - `Key_Container`: The name of the key created in Fortanix DSM. 3. Run the following command to generate the CSR: ```bash certreq.exe -new request.inf request.csr ``` 4. Submit the CSR to your CA for signing. 5. After you receive the signed certificate, install it in the **Current User** certificate store. ## 7.0 Sign a VBA Project in Outlook Perform the following steps to sign a VBA project in Classic Outlook: 1. Open Classic Outlook and navigate to **Developer → Visual Basic**. Create an `.OTM` file. ![](https://cdn.us.document360.io/c3bd85d2-4ad8-4d85-9f60-f1c168a3aad9/Images/Documentation/fortanix-dsm-with-signing-microsoft-visual-basic-for-applications-vba-projects-image-nivnii05.png?sv=2026-02-06&spr=https&st=2026-11-23T23%3A09%3A18Z&se=2026-11-24T00%3A09%3A18Z&sr=b&sp=r&sig=hjGM0Ymngz%2FfJ4zMzxvpZYHxdxpoVq8RE99QkuUnD4s%3D) **Figure 8: Creating the .OTM file** 2. In the Microsoft Visual Basic window, navigate to **Tools → Digital Signature**. 3. Click **Choose..**, select the VBA signing certificate, and click **OK**. ![](https://cdn.us.document360.io/c3bd85d2-4ad8-4d85-9f60-f1c168a3aad9/Images/Documentation/fortanix-dsm-with-signing-microsoft-visual-basic-for-applications-vba-projects-image-wb6avi81.png?sv=2026-02-06&spr=https&st=2026-11-23T23%3A09%3A18Z&se=2026-11-24T00%3A09%3A18Z&sr=b&sp=r&sig=GOP6EbcuaaHa9OaNsit8kZXGBmHAvw8WJHZq2PtIXyM%3D) **Figure 9: Selecting the VBA signing certificate** 4. Save the `.OTM` file. The Fortanix DSM **Audit Log** shows the application authentication and signing operation ![](https://cdn.us.document360.io/c3bd85d2-4ad8-4d85-9f60-f1c168a3aad9/Images/Documentation/fortanix-dsm-with-signing-microsoft-visual-basic-for-applications-vba-projects-image-3mo3hcn0.png?sv=2026-02-06&spr=https&st=2026-11-23T23%3A09%3A18Z&se=2026-11-24T00%3A09%3A18Z&sr=b&sp=r&sig=7GOhRk4BpbStrMrAV%2F6%2BwGy8PySAn1WKfluGK%2BB0BTw%3D) **Figure 10: Fortanix DSM audit log** > [!NOTE] > NOTE > > You can follow similar steps to sign VBA macros in other Microsoft Office applications, such as Excel, Word, and PowerPoint. ## 8.0 Troubleshooting If you encounter issues while signing a VBA project, check the logs in the user's `%APPDATA%` folder. Fortanix Data Security Manager (DSM) is the world’s first cloud service secured with Intel® SGX. With Fortanix DSM, you can securely generate, store, and use cryptographic keys and certificates, as well as other secrets such as passwords, API keys, tokens, or any blob of data. Your business-critical applications and containers can integrate with Fortanix DSM using legacy cryptographic interfaces (PKCS#11, CNG, and JCE) or using the native Fortanix DSM RESTful interface.