mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-01 03:02:28 +03:00
wix installer is also signed (#3266)
This commit is contained in:
parent
529912515e
commit
d801cc89b8
5
.changes/wix-signing.md
Normal file
5
.changes/wix-signing.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"tauri-bundler": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Sign WiX installer in addition to the executable file.
|
@ -387,27 +387,32 @@ 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 {
|
||||||
|
common::print_info(&format!("signing {}", file_path.display()))?;
|
||||||
|
sign(
|
||||||
|
&file_path,
|
||||||
|
&SignParams {
|
||||||
|
digest_algorithm: settings
|
||||||
|
.windows()
|
||||||
|
.digest_algorithm
|
||||||
|
.as_ref()
|
||||||
|
.map(|algorithm| algorithm.to_string())
|
||||||
|
.unwrap_or_else(|| "sha256".to_string()),
|
||||||
|
certificate_thumbprint: certificate_thumbprint.to_string(),
|
||||||
|
timestamp_url: settings
|
||||||
|
.windows()
|
||||||
|
.timestamp_url
|
||||||
|
.as_ref()
|
||||||
|
.map(|url| url.to_string()),
|
||||||
|
},
|
||||||
|
)?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
};
|
||||||
|
|
||||||
if let Some(certificate_thumbprint) = &settings.windows().certificate_thumbprint {
|
common::print_info("trying to sign app")?;
|
||||||
common::print_info("signing app")?;
|
try_sign(&app_exe_source)?;
|
||||||
sign(
|
|
||||||
&app_exe_source,
|
|
||||||
&SignParams {
|
|
||||||
digest_algorithm: settings
|
|
||||||
.windows()
|
|
||||||
.digest_algorithm
|
|
||||||
.as_ref()
|
|
||||||
.map(|algorithm| algorithm.to_string())
|
|
||||||
.unwrap_or_else(|| "sha256".to_string()),
|
|
||||||
certificate_thumbprint: certificate_thumbprint.to_string(),
|
|
||||||
timestamp_url: settings
|
|
||||||
.windows()
|
|
||||||
.timestamp_url
|
|
||||||
.as_ref()
|
|
||||||
.map(|url| url.to_string()),
|
|
||||||
},
|
|
||||||
)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user