Aug 12, 2024
After these new guidelines, conventional way of signing builds using a PFX file is obsolete, and developers are facing issues related to Signing executables. This article will help you in Signing Windows Executables using GlobalSign’s Code Signing Certificate, Azure Key Vault and Azure SignTool.
Pre-requisites:
Step 1: Register Your New Azure Application
Register a new Azure application so you can further connect it with the Key Vault for code signing: -
Step 2: Client Secret Creation
Now, generate a client-secret, which will provide a credential at the time of code signing. For the same, follow the below steps:
· Note:- Copy the Value of the new client secret and save it somewhere safely. Because it is available only once and then it is masked because of the security reasons.
Step 3: Enable Application Access in Azure Key Vault
Now, you need to enable the Access to your application within Microsoft Azure Key-vault:-
· Now, your access policies are created and you are ready for code-signing windows files.
Step 4: Get & Import GlobalSign’s Codesigning Certificate in Azure Key-Vault:
Get a HSM based Code Signing Certificate from GlobalSign (Standard or EV) and then follow the below support article to generate & import GlobalSign’s Code Signing certificate on Key Vault.
https://support.globalsign.com/code-signing/Code-Signing-certificate-setup-in-Azure-Key-vault
Step 5: Install Azure Signtool:
To install the Azure Signtool make sure to have the latest .NET SDK installed, then open Administrator PowerShell and use the following command:
dotnet tool install --global AzureSignTool
Note:- If in case you are getting the below error while downloading Azure Signtool then follow the subsequent steps:
Error - Nuget package not found while running (dotnet tool install --global AzureSignTool)
Try these below steps to install Nuget Package
dotnet nuget add source https://api.nuget.org/v3/index.json -n http://nuget.org
Step 6: Now Sign your Executables:
Once you complete the above steps, you can sign your windows based executable files. But before you begin code signing, ensure the below information is readily available:
azuresigntool sign -kvu "KEY-VAULT-URI" -kvc CERTIFICATE-NAME -kvi "APPLICATION-CLIENT-ID" -kvs "CLIENT-SECRET" --azure-key-vault-tenant-id "tenant-ID" -tr http://timestamp.globalsign.com/tsa/advanced -td sha256 “PATH-TO-EXECUTABLE”
If you have followed the above steps correctly, you’ll be able to see the following output:-
info: AzureSignTool.Program[0]
==> File: test.exe
Signing file test.exe
info: AzureSignTool.Program[0]
==> File: test.exe
Signing completed successfully for file test.exe
https://learn.microsoft.com/en-us/windows/msix/desktop/cicd-keyvault
Check your certificate installation for SSL issues and vulnerabilities.