Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
bdbbe77
feat: test signing customization
svasista-ms Jul 7, 2026
4d0063f
Refactor build signing options to use `--signtool-args` for certifica…
svasista-ms Jul 7, 2026
9753ca4
test: move functional tests for `--signtool-args` passthrough into a …
svasista-ms Jul 7, 2026
6099a73
refactor: improve staging and final package directory handling in pac…
svasista-ms Jul 8, 2026
3f7206b
feat: enhance signtool argument handling and improve security warnings
svasista-ms Jul 12, 2026
dcadac9
feat: enhance signtool argument handling and improve parsing logic
svasista-ms Jul 12, 2026
b66c678
refactor: remove staging paths in packaging process
svasista-ms Jul 14, 2026
653627a
test: add tests for handling empty signtool args and sign mode valida…
svasista-ms Jul 15, 2026
936780f
refactor: move build command args tests into a separate module
svasista-ms Jul 15, 2026
3922c47
test: remove outdated comments from signtool failure test
svasista-ms Jul 15, 2026
e21e4c3
fix: correct formatting of extra file operand in signtool args
svasista-ms Jul 15, 2026
872ddf4
refactor: update help heading for driver signing and verification opt…
svasista-ms Jul 15, 2026
1e23e88
fix: handle empty signtool arguments in parse_signtool_args function
svasista-ms Jul 15, 2026
3e87ce0
docs: fix driver signing options section
svasista-ms Jul 15, 2026
82ab302
Merge branch 'main' into test-signing
svasista-ms Jul 21, 2026
623db92
address review comments
svasista-ms Jul 21, 2026
5ef9b00
refactor: remove `hide_args` parameter and implement `run_with_redact…
svasista-ms Jul 21, 2026
10dcc64
Merge branch 'test-signing' of https://github.com/svasista-ms/windows…
svasista-ms Jul 21, 2026
74343c7
address review comments: file-scoped signtool sign error, escape sing…
svasista-ms Jul 22, 2026
101282b
Merge remote-tracking branch 'upstream/main' into test-signing
svasista-ms Jul 22, 2026
c4182d4
test(cargo-wdk): restore `TargetPlatform::as_infverif_flag` mapping test
svasista-ms Jul 22, 2026
6ac3f53
fix(cargo-wdk): redact `signtool /p` password case-insensitively
svasista-ms Jul 22, 2026
2d349fd
Merge branch 'main' into test-signing
svasista-ms Jul 27, 2026
c8fcabe
fix(cargo-wdk): restore default signtool timestamp countersignature
svasista-ms Jul 27, 2026
fcbc786
refactor(cargo-wdk): move default signtool switches into `sign_and_ve…
svasista-ms Jul 29, 2026
de3cfdf
fix(exec): add comment for lifetime requirement in `run_with_redaction`
svasista-ms Jul 29, 2026
77a3e71
refactor(cargo-wdk): replace `SignMode TryFrom` with `BuildArgs::get_…
svasista-ms Jul 29, 2026
2eed294
docs(cargo-wdk): edit `--signtool-args` note
svasista-ms Jul 29, 2026
f2a8986
docs(cargo-wdk): remove extra `signtool` related documentation
svasista-ms Jul 30, 2026
5a0bb10
fix: ensure file operand is not redacted when password is missing
svasista-ms Jul 30, 2026
2fbf359
refactor: rename `get_sign_mode` to `sign_mode`
svasista-ms Jul 30, 2026
bc7fc65
refactor(cargo-wdk): move action types into the modules that own them
svasista-ms Jul 31, 2026
70ad2b7
refactor(cargo-wdk): address review feedback on signtool signing
svasista-ms Jul 31, 2026
87ef974
test(cargo-wdk): assert package dir recreation ordering via mockall S…
svasista-ms Jul 31, 2026
8139c0c
test(cargo-wdk): simplify extra-operand signing test to a single build
svasista-ms Jul 31, 2026
8f07bf8
Merge branch 'main' into test-signing
svasista-ms Aug 4, 2026
9d8013f
docs(cargo-wdk): clarify signtool arguments description in README and…
svasista-ms Aug 4, 2026
3474cba
fix(cargo-wdk): preserve clap validation error
svasista-ms Aug 5, 2026
332a9b4
fix(cargo-wdk): preserve quoted empty signtool arguments
svasista-ms Aug 5, 2026
2a2b749
fix: stop timestamping for default test signing scenario
svasista-ms Aug 6, 2026
a306e34
Merge branch 'main' into test-signing
svasista-ms Aug 6, 2026
88f380d
Revert "fix: stop timestamping for default test signing scenario"
svasista-ms Aug 11, 2026
4bc24f4
Revert "fix(cargo-wdk): preserve clap validation error"
svasista-ms Aug 11, 2026
a0a868f
Merge branch 'main' into test-signing
svasista-ms Aug 11, 2026
d58cfaa
test: improve error assertions for signtool failures
svasista-ms Aug 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions crates/cargo-wdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ Options:
--locked Assert that `Cargo.lock` will remain unchanged
-h, --help Print help

Driver Signing:
--signtool-args <ARGS> Additional arguments forwarded verbatim to
`signtool sign`, as a single quoted string
(e.g. `--signtool-args "/fd SHA256 /f cert.pfx"`)

Comment on lines +79 to +83
Feature Selection:
--all-features Activate all available features
--no-default-features Do not activate the `default` feature
Expand Down Expand Up @@ -106,6 +111,21 @@ If the `--verify-signature` flag is provided, the signatures are verified after

`--verify-signature` cannot be combined with `--sign-mode=off` because if signing is off there is nothing to verify. Passing both will cause `build` to fail with an error.

##### Customizing signtool arguments

By default test signing uses the auto-generated `WDRLocalTestCert` certificate and cargo-wdk's default switches (`sign /v /s WDRTestCertStore /n WDRLocalTestCert /fd SHA256 <file>`). If you need to sign with your own certificate or tweak any signing option, pass `--signtool-args` with a single quoted string of the arguments you want forwarded to `signtool sign`.

- When `--signtool-args` is **omitted**, cargo-wdk signs with the auto-generated WDR test certificate as described above.
- When `--signtool-args` is **provided**, you own the full `signtool sign` option set (certificate selection, digest algorithm, etc.). cargo-wdk only wraps your arguments with the `sign` verb and the trailing file operand. If your arguments don't include a certificate selector (e.g. `/n`, `/s`, `/f`, `/sha1`), `signtool` auto-selects a code-signing certificate from your personal store and fails if none — or more than one — is found.
Comment thread
gurry marked this conversation as resolved.
Outdated

The string is split into individual arguments on whitespace, honoring single- and double-quoted spans so values containing spaces (e.g. `/n "CN=Contoso Root"`) survive as a single argument. Any shell-level quoting/escaping is your responsibility and is applied by the shell before cargo-wdk sees the value.

`--signtool-args` applies only when signing (i.e. `--sign-mode=test`); supplying it with `--sign-mode=off` is an error.

Consistent with the WDK MSBuild `TestSign` target, the default test signing does **not** timestamp the signature (no `/t`, `/tr`, or `/td` switches). If you require timestamping, add the relevant switches through `--signtool-args`.

If signing fails, the package folder is assembled only after signing succeeds, so a failure never leaves unsigned output in the package directory.

#### Examples

- To build a driver project with default options, navigate to the root of the project and run:
Expand All @@ -131,3 +151,15 @@ If the `--verify-signature` flag is provided, the signatures are verified after
```pwsh
cargo wdk build --sign-mode off
```

- To test-sign with a certificate selected from a store by subject name, run:

```pwsh
cargo wdk build --signtool-args "/s MyStore /n MyCert /fd SHA256"
```

- To test-sign with a PFX file whose password is supplied inline, run:

```pwsh
cargo wdk build --signtool-args "/f C:\certs\my.pfx /p <password> /fd SHA256"
```
Comment thread
svasista-ms marked this conversation as resolved.
Outdated
Comment thread
gurry marked this conversation as resolved.
Outdated
4 changes: 2 additions & 2 deletions crates/cargo-wdk/src/actions/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl<'a> BuildAction<'a> {
working_dir: absolute(params.working_dir)?,
profile: params.profile,
target_arch: params.target_arch,
sign_mode: params.sign_mode,
sign_mode: params.sign_mode.clone(),
is_sample_class: params.is_sample_class,
locked: params.locked,
features: params.features,
Expand Down Expand Up @@ -404,7 +404,7 @@ impl<'a> BuildAction<'a> {
working_dir,
target_dir: &target_dir,
target_arch: &target_arch,
sign_mode: self.sign_mode,
sign_mode: self.sign_mode.clone(),
sample_class: self.is_sample_class,
driver_model,
},
Expand Down
Loading
Loading