Windows Application Distribution
This guide provides information on code signing and uploading your app to the Windows Store.
Code Signing
Code signing your application lets users know that they downloaded the official executable of your app and not some malware that poses as your app. While it is not required, it improves users' confidence in your app.
The following list walks you through the necessary steps to code-sign a Windows application.
-
Prerequisites
This guide assumes you run Windows, either on a physical machine or a Virtual Machine and that you already have a working Tauri application.
-
Get a Code Signing Certificate
To sign your application, you need to acquire a Code Signing certificate from one of the supported certificate authorities like Digicert, Sectigo (formerly Comodo), or Godaddy.
To eliminate all security prompts during installation, you need an extended validation (EV) code signing certificate. These certificates cost upwards of 400$ and require a hardware token. Depending on your country, they might also be sold to companies only.
-
Create
.pfx
CertificateYou need a PKCS 12 Certificate file to sign an executable, commonly called a PFX file. We will take the certificate file (e.g.
cert.cer
) and private key (e.g.private-key.key
) you received from your certificate authority and convert them into a.pfx
file.
Open a PowerShell prompt and enter the following command:openssl pkcs12 -export -in cert.cer -inkey private-key.key -out certificate.pfx
Make sure you don't forget the export password when prompted, we need it in the next step.
-
Import Certificate
You now need to import your newly created
.pfx
certificate into the Windows Keystore. First, we need to store the export password you previously created into an environment variable. The securest option is theGet-Credential
helper; Enter the following command in your PowerShell prompt:$mypwd = Get-Credential ` -UserName 'Enter password below' ` -Message 'Enter password below'
Next, you can use the
Import-PfxCertificate
command to actually import your.pfx
file:Import-PfxCertificate ` -FilePath C:\certificate.pfx ` -CertStoreLocation Cert:\LocalMachine\My ` -Password $mypwd.Password
-
Tauri Configuration
To configure Tauri for code signing we need to enter a few things into our
tauri.conf.json
file:-
certificateThumbprint
- The SHA-1 thumbprint of your certificate. Enter the following command and copy the values forlocalKeyID
without spaces.openssl pkcs12 -info -in certificate.pfx
For this example output the
certificateThumbprint
is
A1B1A2B2A3B3A4B4A5B5A6B6A7B7A8B8A9B9A0B0
.Bag Attributes localKeyID: A1 B1 A2 B2 A3 B3 A4 B4 A5 B5 A6 B6 A7 B7 A8 B8 A9 B9 A0 B0
-
digestAlgorithm
- The SHA digest algorithm used for your certificate. This is likelysha256
. -
timestampUrl
- A URL pointing to a timestamp server used to verify the time the certificate is signed. It's best to provide the timestamp server provided by your certificate authority here. -
tsp
- Enables the Time-Stamp Protocol (TSP, defined by RFC 3161) instead of NTP. Some certificate authorities, like SSL.com only provide TSP servers.
"bundle": { "windows": { "certificateThumbprint": "A1B1A2B2A3B3A4B4A5B5A6B6A7B7A8B8A9B9A0B0", "digestAlgorithm": "sha256", "timestampUrl": "http://timestamp.comodoca.com", "tsp": false } }
-
-
Sign your Application
Now you can run
tauri build
and you will see the following additional output:info: signing app info: running signtool "C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.19041.0\\x64\\signtool.exe" info: Done Adding Additional Store Successfully signed: APPLICATION FILE PATH HERE
And that's it! You have successfully signed your Tauri application!
Continous Integration
As the above-described process is rather laborious, most developers run this step as an automated part of their Continous Integration (CI). For users of GitHub Actions Tauri provides the Tauri Action, which simplifies the setup.
Note: The following example assumes you store the secret passwords and tokens using GitHub Secrets.