Skip to main content

SignTool Command Line Tool Usage Guide

SignTool is the command-line client for sslTrus remote code signing service, used to perform code signing operations in terminals or automated scripts.

Quick Start​

Below is a basic signing command example. You can copy it and modify it according to the comments before use:

# 视情况而定,是否需要开启调试模式
#export DEBUG=1

# 使用环境变量配置 AK、SK 以及证书订阅号
export SIGNTOOL_ACCESS_KEY='' SIGNTOOL_ACCESS_SECRET='' SIGNTOOL_CERT_CODE=''

# 签名
./signtool sign \
--dry-run \
--access-key=$SIGNTOOL_ACCESS_KEY \
--access-secret=$SIGNTOOL_ACCESS_SECRET \
--cert-code=$SIGNTOOL_CERT_CODE \
--file=app-unsigned.exe \
--out=app.exe \
--sha1=false \
--sha2=true \
--timestamp-rfc3161 http://timestamp.acs.microsoft.com

Command Details​

Before you begin, you need to prepare the following three pieces of information:

Viewing Help​

Use the -h or --help parameter to view the full command help.

./signtool sign -h

Core Parameter Reference​

ParameterAbbreviationRequiredDescription & Example
--access-key-kYesAPI access key. Can also be set via the SIGNTOOL_ACCESS_KEY environment variable.
--access-secret-sYesAPI access secret. Can also be set via the SIGNTOOL_ACCESS_SECRET environment variable.
--cert-code-cYesSubscription code for the remote code signing service, used to specify the signing certificate and billing.
--file-fYesPath to the file to be signed. Example: -f "app.dll".
--out-oNoPath for the output file. By default, .signed is appended to the original file name. Important: The operation will fail if the file already exists.
--overrideNoWhether to overwrite the path of the file to be signed. Defaults to false.
--sha1-1NoEnable signing with the SHA1 algorithm (for legacy system compatibility).
--sha2-2NoEnable signing with the SHA256 algorithm (modern standard, recommended).
--nestNoWhether to use nested signing. When the file already has a signature, --nest=true (default) preserves the original signature and adds a new one; false clears the old signature. Comparison of effects: nest
--timestampNoTimestamp server URL used for SHA1 signing. Set to an empty string "" to disable.
--timestamp-rfc3161NoRFC 3161 timestamp server URL used for SHA256 signing. Set to an empty string "" to disable.
--desc-nNoProgram description. This information is embedded in the signature and may be displayed in system security prompts, as shown below: desc
--url-uNoOfficial information link for the program.
--verifyNoVerify the file signature immediately after signing.
--dry-runNoTrial mode. In this mode, a self-signed certificate is used to verify the signing workflow, and the access key and subscription code can be filled in arbitrarily.

About Boolean Parameters​

For parameters that accept true/false values (such as --sha1, --nest), you must use the parameter=value format; space separation is not supported.

  • Correct: --sha1=true --sha2=false
  • Incorrect: --sha1 true --sha2 false