> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Bach builds Windows installers from one bach.toml with the bach command: bach init, bach check, bach preview, bach build. Installs are per user and need no administrator rights by default. installer.scope = "machine" installs for every user after one Windows prompt. On Windows, run setup files with Start-Process -Wait -PassThru in PowerShell, and give signtool arguments that start with the word sign.

# [signing]: how Bach signs your files

> The program and arguments settings, placeholders, when signing runs, what gets signed, and examples for signtool and cloud signing services.

`[signing]` tells Bach which program signs your setup files. It does nothing until you build with `--sign`. Walkthrough: [Sign your setup file](/docs/guides/signing.md).

```toml bach.toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
[signing]
program = "signtool"
arguments = 'sign /fd SHA256 /tr http://timestamp.digicert.com /td SHA256 /a'
```

| Setting | Default | Meaning |
| - | - | - |
| `program` | `"signtool"` | The signing program, started without a shell. If `signtool` isn't on `PATH`, Bach uses the newest one in the Windows SDK folder and says which. |
| `arguments` | required | Split like a command line. For signtool, must start with `sign`. |

In `arguments`, `{file}` is the file to sign (added at the end if absent) and `{env:NAME}` an environment variable, so secrets stay out of the file.

## When it runs

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
bach build --sign
bach sign "dist/Hello Notes-Setup-1.0.0.exe"
```

`BACH_SIGN=1` does the same as `--sign`. A build with `[signing]` but without `--sign` says the files weren't signed. `--sign` without `[signing]` is an error.

With `--sign`, Bach signs every setup file it writes (including the online installer and patches) before writing the update feed. It prints the command with `{env:NAME}` not expanded. If the signer fails, the build fails. With `updates.signer` set, Bach also checks that the certificate matches. For a Mac build it checks the Setup app instead, see [Protect your updates](/docs/guides/update-security.md#on-a-mac).

## Unsigned programs inside

With `[signing]` present, `bach check` and `bach build` warn when programs or libraries in your files aren't signed, naming the first three.

## A cloud signing service

```toml bach.toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
[signing]
program = "AzureSignTool"
arguments = 'sign --azure-key-vault-url {env:KV_URL} --azure-key-vault-certificate {env:KV_CERT} -tr http://timestamp.digicert.com'
```

The signing program must be installed on the build computer. On macOS or Linux, use one that runs there, such as `osslsigncode`. The Mac build uses [`[macos.signing]`](/docs/reference/config/macos) instead.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.