Skip to content

Commit d801cc8

Browse files
authored
wix installer is also signed (#3266)
1 parent 5299125 commit d801cc8

File tree

2 files changed

+31
-20
lines changed

2 files changed

+31
-20
lines changed

.changes/wix-signing.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri-bundler": patch
3+
---
4+
5+
Sign WiX installer in addition to the executable file.

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

+26-20
Original file line numberDiff line numberDiff line change
@@ -387,27 +387,32 @@ pub fn build_wix_app_installer(
387387
.find(|bin| bin.main())
388388
.ok_or_else(|| anyhow::anyhow!("Failed to get main binary"))?;
389389
let app_exe_source = settings.binary_path(main_binary);
390+
let try_sign = |file_path: &PathBuf| -> crate::Result<()> {
391+
if let Some(certificate_thumbprint) = &settings.windows().certificate_thumbprint {
392+
common::print_info(&format!("signing {}", file_path.display()))?;
393+
sign(
394+
&file_path,
395+
&SignParams {
396+
digest_algorithm: settings
397+
.windows()
398+
.digest_algorithm
399+
.as_ref()
400+
.map(|algorithm| algorithm.to_string())
401+
.unwrap_or_else(|| "sha256".to_string()),
402+
certificate_thumbprint: certificate_thumbprint.to_string(),
403+
timestamp_url: settings
404+
.windows()
405+
.timestamp_url
406+
.as_ref()
407+
.map(|url| url.to_string()),
408+
},
409+
)?;
410+
}
411+
Ok(())
412+
};
390413

391-
if let Some(certificate_thumbprint) = &settings.windows().certificate_thumbprint {
392-
common::print_info("signing app")?;
393-
sign(
394-
&app_exe_source,
395-
&SignParams {
396-
digest_algorithm: settings
397-
.windows()
398-
.digest_algorithm
399-
.as_ref()
400-
.map(|algorithm| algorithm.to_string())
401-
.unwrap_or_else(|| "sha256".to_string()),
402-
certificate_thumbprint: certificate_thumbprint.to_string(),
403-
timestamp_url: settings
404-
.windows()
405-
.timestamp_url
406-
.as_ref()
407-
.map(|url| url.to_string()),
408-
},
409-
)?;
410-
}
414+
common::print_info("trying to sign app")?;
415+
try_sign(&app_exe_source)?;
411416

412417
// ensure that `target/{release, debug}/wix` folder exists
413418
std::fs::create_dir_all(settings.project_out_directory().join("wix"))?;
@@ -653,6 +658,7 @@ pub fn build_wix_app_installer(
653658
settings,
654659
)?;
655660
rename(&msi_output_path, &msi_path)?;
661+
try_sign(&msi_path)?;
656662

657663
Ok(msi_path)
658664
}

0 commit comments

Comments
 (0)