Digitally Signing Your Installer Package with SignTool in Paquet Builder¶
To ensure users trust the authenticity of your package, you can digitally sign it using Microsoft Authenticode thanks to Paquet Builder. This guarantees that the package has not been modified since its release.
Paquet Builder can handle signing your installer for you, either with its built-in utility GSignCode or, for more advanced use cases aimed at experienced users, Microsoft SignTool.
Below, we describe the procedure to use SignTool. If you do not require advanced features, please refer to the topic Adding a Digital Signature.
1. Prerequisites¶
Before using SignTool, ensure that:
- You have a valid code signing certificate installed in your system.
- You have installed the Windows SDK, which includes SignTool.exe.
- ๐ Download the latest Windows SDK from the official Microsoft website:
Windows SDK Download
2. Enabling Digital Signing in Paquet Builder¶
- Open Paquet Builder and navigate to the Digital sign package page.
- Check the box "Digitally sign my package".
- Configure the SignTool Commands by specifying the appropriate parameters.
3. Understanding SignTool Parameters in Paquet Builder¶
Paquet Builder allows you to dynamically reference the installer file and output directory using placeholders. This ensures flexibility and reduces the need for manual path configuration.
Example SignTool Command in Paquet Builder¶
sign /a /fd SHA256 /tr "http://timestamp.digicert.com" /td SHA256 "{$PBOUTPUTFILE$}"
Warning
Do not add signtool.exe nor its path: Paquet Builder automatically deals with it.
Breakdown of Parameters and Placeholders¶
Parameter | Description |
---|---|
/a | Automatically selects the best certificate available in the systemโs certificate store. |
/fd SHA256 | Specifies the file digest algorithm (SHA-256 is recommended). |
/tr "http://timestamp.digicert.com" | Defines the timestamp server for RFC 3161 timestamping. |
/td SHA256 | Specifies the digest algorithm for the timestamp. |
{$BOUTPUTFILES} | Automatically inserts the full path to the installer file(s) to be signed. |
Available Placeholders in Paquet Builder¶
Placeholder | Description |
---|---|
{$PBOUTPUTFILE$} | Represents the full path to the executable file(s) to be signed. |
{$PBOUTPUTFOLDER$} | Represents the path to the output directory where the signed file will be stored. |
These placeholders allow Paquet Builder to dynamically insert the correct file paths during the signing process, eliminating the need to hardcode file locations.
4. Signing Your Installer Package¶
Once the SignTool Commands are configured, click Build in Paquet Builder. The tool will automatically invoke SignTool to sign the generated executable.
Tip
โ
If you encounter signing errors, check that:
- Your certificate is installed in the systemโs certificate store.
- The timestamp server is reachable.
5. Alternative: Signing with a Specific Certificate¶
If you need to sign with a specific certificate (instead of letting SignTool choose automatically), you can use:
sign /fd SHA256 /sha1 ABCD1234... /tr "http://timestamp.digicert.com" /td SHA256 {$PBOUTPUTFILE$}
/sha1 ABCD1234...
โ Selects a certificate using its SHA-1 fingerprint.-
/n "My Certificate Name"
โ Selects a certificate by its common name. For more details, refer to the official SignTool Documentation.
Multiple Digital Signatures in Paquet Builder¶
In Paquet Builder, il is possible to execute multiple SignTool commands sequentially by entering them line by line in the designated field. Each command will be executed in order, allowing you to apply multiple signatures, such as adding both SHA-1 and SHA-256 signatures to your installer.
Example: Dual SHA-1 and SHA-256 Signatures¶
To sign an installer first with SHA-1 and then with SHA-256, enter the following commands on separate lines in the SignTool Commands field:
sign /a /fd SHA1 /tr "http://timestamp.digicert.com" /td SHA1 "{$PBOUTPUTFILE$}"
sign /a /fd SHA256 /tr "http://timestamp.digicert.com" /td SHA256 "{$PBOUTPUTFILE$}"
Explanation¶
- The first command signs the installer using SHA-1 (useful for backward compatibility with older systems).
- The second command adds an additional SHA-256 signature, ensuring compliance with modern security standards.
๐ก By entering each command on a new line, Paquet Builder will execute them one after the other automatically.
Defining the Path to SignTool in Paquet Builder¶
Before using SignTool, you must ensure that its path is correctly set in Paquet Builder.
In Paquet Builder, go to:
๐น Menu โ Environment Options โ Code Signing
Here, you will find the field where you need to specify the path to SignTool.exe.
Automatically Detecting SignTool¶
- Click on the magnifying glass button ๐.
- Paquet Builder will attempt to locate SignTool.exe automatically by checking the Windows registry.
Manually Setting the Path¶
If Paquet Builder cannot find SignTool, you will need to manually enter the full path to SignTool.exe.
- Typically, SignTool is located in:
C:\Program Files (x86)\Windows Kits\10\bin\X.X.X.X\x64\signtool.exe
Tip
๐ก If you have multiple versions of the Windows SDK installed, ensure you select the correct one that contains SignTool.exe.