Skip to content

Commit bdd5f7c

Browse files
gardclucasfernog
andauthored
fix: add support for Time-Stamping Protocol for Windows codesigning (fix #3563) (#3570)
Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.studio>
1 parent 76c791b commit bdd5f7c

File tree

7 files changed

+35
-1
lines changed

7 files changed

+35
-1
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"tauri-bundler": patch
3+
"cli.rs": patch
4+
"cli.js": patch
5+
"tauri": patch
6+
---
7+
8+
Added `tsp` config option under `tauri > bundle > windows`, which enables Time-Stamp Protocol (RFC 3161) for the timestamping
9+
server under code signing on Windows if set to `true`.

core/tauri-utils/src/config.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,9 @@ pub struct WindowsConfig {
239239
pub certificate_thumbprint: Option<String>,
240240
/// Server to use during timestamping.
241241
pub timestamp_url: Option<String>,
242+
/// Whether to use Time-Stamp Protocol (TSP, a.k.a. RFC 3161) for the timestamp server. Your code signing provider may
243+
/// use a TSP timestamp server, like e.g. SSL.com does. If so, enable TSP by setting to true.
244+
pub tsp: Option<bool>,
242245
/// Path to the webview fixed runtime to use.
243246
///
244247
/// The fixed version can be downloaded [on the official website](https://developer.microsoft.com/en-us/microsoft-edge/webview2/#download-section).

tooling/bundler/src/bundle/settings.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,9 @@ pub struct WindowsSettings {
241241
pub certificate_thumbprint: Option<String>,
242242
/// Server to use during timestamping.
243243
pub timestamp_url: Option<String>,
244+
/// Whether to use Time-Stamp Protocol (TSP, a.k.a. RFC 3161) for the timestamp server. Your code signing provider may
245+
/// use a TSP timestamp server, like e.g. SSL.com does. If so, enable TSP by setting to true.
246+
pub tsp: Option<bool>,
244247
/// WiX configuration.
245248
pub wix: Option<WixSettings>,
246249
/// The path to the application icon. Defaults to `./icons/icon.ico`.
@@ -255,6 +258,7 @@ impl Default for WindowsSettings {
255258
digest_algorithm: None,
256259
certificate_thumbprint: None,
257260
timestamp_url: None,
261+
tsp: None,
258262
wix: None,
259263
icon_path: PathBuf::from("icons/icon.ico"),
260264
webview_fixed_runtime_path: None,

tooling/bundler/src/bundle/windows/msi/wix.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ pub fn build_wix_app_installer(
404404
.timestamp_url
405405
.as_ref()
406406
.map(|url| url.to_string()),
407+
tsp: settings.windows().tsp,
407408
},
408409
)?;
409410
}

tooling/bundler/src/bundle/windows/sign.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub struct SignParams {
1919
pub digest_algorithm: String,
2020
pub certificate_thumbprint: String,
2121
pub timestamp_url: Option<String>,
22+
pub tsp: Option<bool>,
2223
}
2324

2425
// sign code forked from https://github.com/forbjok/rust-codesign
@@ -101,7 +102,12 @@ pub fn sign<P: AsRef<Path>>(path: P, params: &SignParams) -> crate::Result<()> {
101102
cmd.args(&["/sha1", &params.certificate_thumbprint]);
102103

103104
if let Some(ref timestamp_url) = params.timestamp_url {
104-
cmd.args(&["/t", timestamp_url]);
105+
if params.tsp == Some(true) {
106+
cmd.args(&["/tr", timestamp_url]);
107+
cmd.args(&["/td", &params.digest_algorithm]);
108+
} else {
109+
cmd.args(&["/t", timestamp_url]);
110+
}
105111
}
106112

107113
cmd.arg(path_str);

tooling/cli/schema.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@
147147
"certificateThumbprint": null,
148148
"digestAlgorithm": null,
149149
"timestampUrl": null,
150+
"tsp": null,
150151
"webviewFixedRuntimePath": null,
151152
"wix": null
152153
}
@@ -563,6 +564,7 @@
563564
"certificateThumbprint": null,
564565
"digestAlgorithm": null,
565566
"timestampUrl": null,
567+
"tsp": null,
566568
"webviewFixedRuntimePath": null,
567569
"wix": null
568570
},
@@ -1640,6 +1642,7 @@
16401642
"certificateThumbprint": null,
16411643
"digestAlgorithm": null,
16421644
"timestampUrl": null,
1645+
"tsp": null,
16431646
"webviewFixedRuntimePath": null,
16441647
"wix": null
16451648
}
@@ -2072,6 +2075,13 @@
20722075
"null"
20732076
]
20742077
},
2078+
"tsp": {
2079+
"description": "Whether to use Time-Stamp Protocol (TSP, a.k.a. RFC 3161) for the timestamp server. Your code signing provider may use a TSP timestamp server, like e.g. SSL.com does. If so, enable TSP by setting to true.",
2080+
"type": [
2081+
"boolean",
2082+
"null"
2083+
]
2084+
},
20752085
"webviewFixedRuntimePath": {
20762086
"description": "Path to the webview fixed runtime to use.\n\nThe fixed version can be downloaded [on the official website](https://developer.microsoft.com/en-us/microsoft-edge/webview2/#download-section). The `.cab` file must be extracted to a folder and this folder path must be defined on this field.",
20772087
"type": [

tooling/cli/src/interface/rust.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ fn tauri_config_to_bundle_settings(
479479
},
480480
windows: WindowsSettings {
481481
timestamp_url: config.windows.timestamp_url,
482+
tsp: config.windows.tsp,
482483
digest_algorithm: config.windows.digest_algorithm,
483484
certificate_thumbprint: config.windows.certificate_thumbprint,
484485
wix: config.windows.wix.map(|w| {

0 commit comments

Comments
 (0)