wix installer is also signed (#3266)

This commit is contained in:
Wojciech Niedźwiedź 2022-01-23 21:50:05 +01:00 committed by GitHub
parent 529912515e
commit d801cc89b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 20 deletions

5
.changes/wix-signing.md Normal file
View File

@ -0,0 +1,5 @@
---
"tauri-bundler": patch
---
Sign WiX installer in addition to the executable file.

View File

@ -387,11 +387,11 @@ pub fn build_wix_app_installer(
.find(|bin| bin.main()) .find(|bin| bin.main())
.ok_or_else(|| anyhow::anyhow!("Failed to get main binary"))?; .ok_or_else(|| anyhow::anyhow!("Failed to get main binary"))?;
let app_exe_source = settings.binary_path(main_binary); let app_exe_source = settings.binary_path(main_binary);
let try_sign = |file_path: &PathBuf| -> crate::Result<()> {
if let Some(certificate_thumbprint) = &settings.windows().certificate_thumbprint { if let Some(certificate_thumbprint) = &settings.windows().certificate_thumbprint {
common::print_info("signing app")?; common::print_info(&format!("signing {}", file_path.display()))?;
sign( sign(
&app_exe_source, &file_path,
&SignParams { &SignParams {
digest_algorithm: settings digest_algorithm: settings
.windows() .windows()
@ -408,6 +408,11 @@ pub fn build_wix_app_installer(
}, },
)?; )?;
} }
Ok(())
};
common::print_info("trying to sign app")?;
try_sign(&app_exe_source)?;
// ensure that `target/{release, debug}/wix` folder exists // ensure that `target/{release, debug}/wix` folder exists
std::fs::create_dir_all(settings.project_out_directory().join("wix"))?; std::fs::create_dir_all(settings.project_out_directory().join("wix"))?;
@ -653,6 +658,7 @@ pub fn build_wix_app_installer(
settings, settings,
)?; )?;
rename(&msi_output_path, &msi_path)?; rename(&msi_output_path, &msi_path)?;
try_sign(&msi_path)?;
Ok(msi_path) Ok(msi_path)
} }