Skip to content

Commit f318e9a

Browse files
Updated Signtool-exe.md to include coming crypto changes to the tool (#21048)
Co-authored-by: Youssef Victor <31348972+Youssef1313@users.noreply.github.com>
1 parent bc42b24 commit f318e9a

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

docs/framework/tools/signtool-exe.md

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ ms.assetid: 0c25ff6c-bff3-422e-b017-146a3ee86cb9
1010
# SignTool.exe (Sign Tool)
1111
Sign Tool is a command-line tool that digitally signs files, verifies signatures in files, and time-stamps files.
1212

13-
This tool is automatically installed with Visual Studio. To run the tool, use the Developer Command Prompt for Visual Studio (or the Visual Studio Command Prompt in Windows 7). For more information, see [Command Prompts](developer-command-prompt-for-vs.md).
13+
This tool is automatically installed with Visual Studio. To run the tool, use the Developer Command Prompt for Visual Studio (or the Visual Studio Command Prompt in Windows 7). For more information, see [Command Prompts](developer-command-prompt-for-vs.md).
14+
15+
> [!Note]
16+
> The Windows 10 SDK, Windows 10 HLK, Windows 10 WDK and Windows 10 ADK **builds 20236 and later** require specifying the digest algorithm. The SignTool `sign` command requires the `/fd` **file digest algorithm** and the `/td` **timestamp digest algorithm** option to be specified during signing and timestamping, respectively. A warning (error code 0, initially) will be thrown if `/fd` is not specified during signing and if `/td` is not specified during timestamping. In later versions of SignTool, the warning will become an error. SHA256 is recommended and considered to be more secure than SHA1 by the industry.
1417
1518
At the command prompt, type the following:
1619

@@ -70,7 +73,8 @@ signtool [command] [options] [file_name | ...]
7073
|`/d` *Desc*|Specifies a description of the signed content.|
7174
|`/du` *URL*|Specifies a Uniform Resource Locator (URL) for the expanded description of the signed content.|
7275
|`/f` *SignCertFile*|Specifies the signing certificate in a file. If the file is in Personal Information Exchange (PFX) format and protected by a password, use the `/p` option to specify the password. If the file does not contain private keys, use the `/csp` and `/kc` options to specify the CSP and private key container name.|
73-
|`/fd`|Specifies the file digest algorithm to use for creating file signatures. The default is SHA1.|
76+
|`/fd`|Specifies the file digest algorithm to use for creating file signatures. </br> **Note:** A warning is generated if the`/fd` switch is not provided while signing. The default algorithm is SHA1 but SHA256 is recommended.|
77+
|`/fd` *certHash*|Specifying the string *certHash* will default to the algorithm used on the signing certificate. </br> **Note:** Only available in Windows 10 kit builds 20236 and later.|
7478
|`/i` *IssuerName*|Specifies the name of the issuer of the signing certificate. This value can be a substring of the entire issuer name.|
7579
|`/kc` *PrivKeyContainerName*|Specifies the private key container name.|
7680
|`/n` *SubjectName*|Specifies the name of the subject of the signing certificate. This value can be a substring of the entire subject name.|
@@ -85,8 +89,8 @@ signtool [command] [options] [file_name | ...]
8589
|`/sha1` *Hash*|Specifies the SHA1 hash of the signing certificate. The SHA1 hash is commonly specified when multiple certificates satisfy the criteria specified by the remaining switches.|
8690
|`/sm`|Specifies that a machine store, instead of a user store, is used.|
8791
|`/t` *URL*|Specifies the URL of the time stamp server. If this option (or `/tr`) is not present, the signed file will not be time stamped. A warning is generated if time stamping fails. This option cannot be used with the `/tr` option.|
88-
|`/td` *alg*|Used with the `/tr` option to request a digest algorithm used by the RFC 3161 time stamp server.|
89-
|`/tr` *URL*|Specifies the URL of the RFC 3161 time stamp server. If this option (or `/t`) is not present, the signed file will not be time stamped. A warning is generated if time stamping fails. This option cannot be used with the `/t` option.|
92+
|`/td` *alg*|Used with the `/tr` option to request a digest algorithm used by the RFC 3161 time stamp server. </br> **Note:** A warning is generated if the `/td` switch is not provided while timestamping. The default algorithm is SHA1, but SHA256 is recommended. <br/> The `/td` switch must be declared after the `/tr` switch, not before. If the `/td` switch is declared before the `/tr` switch, the timestamp that is returned is from the SHA1 algorithm instead of the intended SHA256 algorithm. |
93+
|`/tr` *URL*|Specifies the URL of the RFC 3161 time stamp server. If this option (or `/t`) is not present, the signed file will not be time stamped. A warning is generated if time stamping fails. This option cannot be used with the `/t` option.|
9094
|`/u` *Usage*|Specifies the enhanced key usage (EKU) that must be present in the signing certificate. The usage value can be specified by OID or string. The default usage is "Code Signing" (1.3.6.1.5.5.7.3.3).|
9195
|`/uw`|Specifies usage of "Windows System Component Verification" (1.3.6.1.4.1.311.10.3.6).|
9296

@@ -100,7 +104,7 @@ signtool [command] [options] [file_name | ...]
100104
|----------------------|-----------------|
101105
|`/p7`|Time stamps PKCS #7 files.|
102106
|`/t` *URL*|Specifies the URL of the time stamp server. The file being time stamped must have previously been signed. Either the `/t` or the `/tr` option is required.|
103-
|`/td` *alg*|Requests a digest algorithm used by the RFC 3161 time stamp server. `/td` is used with the `/tr` option.|
107+
|`/td` *alg*|Used with the `/tr` option to request a digest algorithm used by the RFC 3161 time stamp server. </br> **Note:** A warning is generated if the `/td` switch is not provided while timestamping. The default algorithm is SHA1, but SHA256 is recommended. <br/> The `/td` switch must be declared after the `/tr` switch, not before. If the `/td` switch is declared before the `/tr` switch, the timestamp that is returned is from the SHA1 algorithm instead of the intended SHA256 algorithm. |
104108
|`/tp` *index*|Time stamps the signature at *index*.|
105109
|`/tr` *URL*|Specifies the URL of the RFC 3161 time stamp server. The file being time stamped must have previously been signed. Either the `/tr` or the `/t` option is required.|
106110

@@ -140,7 +144,7 @@ signtool [command] [options] [file_name | ...]
140144
|0|Execution was successful.|
141145
|1|Execution has failed.|
142146
|2|Execution has completed with warnings.|
143-
147+
144148
## Examples
145149
The following command adds the catalog file MyCatalogFileName.cat to the system component and driver database. The `/u` option generates a unique name if necessary to prevent replacing an existing catalog file named `MyCatalogFileName.cat`.
146150

@@ -150,38 +154,44 @@ signtool catdb /v /u MyCatalogFileName.cat
150154

151155
The following command signs a file automatically by using the best certificate.
152156

153-
```console
154-
signtool sign /a MyFile.exe
155-
```
156-
157+
```console
158+
signtool sign /a /fd SHA256 MyFile.exe
159+
```
160+
157161
The following command digitally signs a file by using a certificate stored in a password-protected PFX file.
158162

159163
```console
160-
signtool sign /f MyCert.pfx /p MyPassword MyFile.exe
164+
signtool sign /f MyCert.pfx /p MyPassword /fd SHA256 MyFile.exe
161165
```
162166

163167
The following command digitally signs and time-stamps a file. The certificate used to sign the file is stored in a PFX file.
164168

165169
```console
166-
signtool sign /f MyCert.pfx /t http://timestamp.digicert.com MyFile.exe
170+
signtool sign /f MyCert.pfx /t http://timestamp.digicert.com /fd SHA256 MyFile.exe
167171
```
168172

169173
The following command signs a file by using a certificate located in the `My` store that has a subject name of `My Company Certificate`.
170174

171175
```console
172-
signtool sign /n "My Company Certificate" MyFile.exe
176+
signtool sign /n "My Company Certificate" /fd SHA256 MyFile.exe
173177
```
174178

175179
The following command signs an ActiveX control and provides information that is displayed by Internet Explorer when the user is prompted to install the control.
176180

177181
```console
178-
Signtool sign /f MyCert.pfx /d: "MyControl" /du http://www.example.com/MyControl/info.html MyControl.exe
182+
Signtool sign /f MyCert.pfx /d: "MyControl" /du http://www.example.com/MyControl/info.html /fd SHA256 MyControl.exe
179183
```
180184

181185
The following command time-stamps a file that has already been digitally signed.
182186

183187
```console
184-
signtool timestamp /t http://timestamp.digicert.com MyFile.exe
188+
signtool timestamp /t http://timestamp.digicert.com MyFile.exe
189+
```
190+
191+
The following command time-stamps a file using an RFC 3161 timestamp server.
192+
193+
```console
194+
signtool timestamp /tr http://timestamp.digicert.com /td SHA256 MyFile.exe
185195
```
186196

187197
The following command verifies that a file has been signed.

0 commit comments

Comments
 (0)