Skip to content

Commit

Permalink
cli/avb: Add --public-key option for extract-avb subcommand
Browse files Browse the repository at this point in the history
Issue: #312

Signed-off-by: Andrew Gunnerson <[email protected]>
  • Loading branch information
chenxiaolong committed Jun 26, 2024
1 parent 8f3c24d commit 672bccc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions avbroot/src/cli/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ pub fn key_main(cli: &KeyCli) -> Result<()> {
.with_context(|| format!("Failed to load key: {p:?}"))?;

private_key.to_public_key()
} else if let Some(p) = &c.input.public_key {
crypto::read_pem_public_key_file(p)
.with_context(|| format!("Failed to load public key: {p:?}"))?
} else if let Some(p) = &c.input.cert {
let certificate = crypto::read_pem_cert_file(p)
.with_context(|| format!("Failed to load certificate: {p:?}"))?;
Expand Down Expand Up @@ -93,6 +96,10 @@ struct PublicKeyInputGroup {
#[arg(short, long, value_name = "FILE", value_parser)]
key: Option<PathBuf>,

/// Path to public key.
#[arg(short, long, value_name = "FILE", value_parser, conflicts_with_all = ["pass_env_var", "pass_file"])]
public_key: Option<PathBuf>,

/// Path to certificate.
#[arg(short, long, value_name = "FILE", value_parser, conflicts_with_all = ["pass_env_var", "pass_file"])]
cert: Option<PathBuf>,
Expand Down

0 comments on commit 672bccc

Please sign in to comment.