feat: updates hmac enc

This commit is contained in:
2025-05-06 23:19:40 +08:00
parent 63fabc6054
commit 81f7a6d77e
5 changed files with 13 additions and 27 deletions

View File

@@ -1,7 +1,7 @@
use crate::cmd_se_generate::print_se_key;
use crate::keyutil::{parse_key_uri, KeyUsage};
use crate::{cmdutil, seutil};
use clap::{App, Arg, ArgMatches, SubCommand};
use crate::{cmd_hmac_decrypt, cmdutil, seutil};
use clap::{App, ArgMatches, SubCommand};
use rust_util::util_clap::{Command, CommandError};
pub struct CommandImpl;
@@ -14,13 +14,7 @@ impl Command for CommandImpl {
fn subcommand<'a>(&self) -> App<'a, 'a> {
SubCommand::with_name(self.name())
.about("Secure Enclave recover subcommand")
.arg(
Arg::with_name("key")
.long("key")
.required(true)
.takes_value(true)
.help("Key uri"),
)
.arg(cmdutil::build_key_uri_arg())
.arg(cmdutil::build_json_arg())
}
@@ -29,7 +23,8 @@ impl Command for CommandImpl {
seutil::check_se_supported()?;
let key = sub_arg_matches.value_of("key").unwrap();
let key_uri = parse_key_uri(key)?;
let key = cmd_hmac_decrypt::try_hmac_decrypt(key)?;
let key_uri = parse_key_uri(&key)?;
let se_key_uri = key_uri.as_secure_enclave_key()?;
debugging!("Secure enclave key URI: {:?}", se_key_uri);
@@ -39,7 +34,7 @@ impl Command for CommandImpl {
se_key_uri.usage == KeyUsage::Singing,
)?;
print_se_key(json_output, &public_key_point, &public_key_der, key);
print_se_key(json_output, &public_key_point, &public_key_der, &key);
Ok(None)
}