-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Application package signing (#287)
* refactor resources mod * refactor resources module * wip * rename ManifestResource to ResourceBuilder * update comments * add copy_package_to_package_test test * wip * fix * finish application package build * add test * wip * wip * update app package test * fix spelling * rename `PackagePath` to `Path` * moved all hdf5 related code to under the hdf5 module, created new `Dir` struct * remove duplicated package::resource module * remove duplicated package::path module * add hdf5::File struct * update `Package` struct * wip * wip * fix spelling * fix fmt * wip * update docs * implement app author cose payload object * update `validate` functions * add signature test * add app sign cli command, update docs * wip * wip * rename manifest "file" field to "package" * wip * fix app signing, update test * fix spelling * update descriptions * wip
- Loading branch information
Showing
18 changed files
with
866 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
//! cli app sign command | ||
use std::path::PathBuf; | ||
|
||
use clap::Args; | ||
use console::Emoji; | ||
|
||
use crate::packaging::{ | ||
app::ApplicationPackage, | ||
sign::{certificate::Certificate, keys::PrivateKey}, | ||
}; | ||
|
||
/// Application package signing | ||
#[derive(Args)] | ||
pub(crate) struct SignCommand { | ||
/// Defines the location of the builded application package. | ||
package: PathBuf, | ||
|
||
/// Defines the location of the ED2559 private key associated with the signing key. | ||
private_key: PathBuf, | ||
|
||
/// Defines the location of the x.509 certificate associated with the signing key. | ||
cert: PathBuf, | ||
} | ||
|
||
impl SignCommand { | ||
/// Run cli command | ||
pub(crate) fn exec(self) -> anyhow::Result<()> { | ||
println!("{} Sign application package...", Emoji::new("📝", "")); | ||
|
||
let private_key = PrivateKey::from_file(self.private_key)?; | ||
let cert = Certificate::from_file(self.cert)?; | ||
let package = ApplicationPackage::from_file(self.package)?; | ||
|
||
package.validate(true)?; | ||
package.author_sign(&private_key, &cert)?; | ||
|
||
println!("{} Done", Emoji::new("✅", "")); | ||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.