feat: decrypt ecdh works

This commit is contained in:
2023-09-07 23:12:04 +08:00
parent 3a4af50e27
commit 3d40730cb5
6 changed files with 799 additions and 52 deletions

View File

@@ -9,6 +9,7 @@ mod util;
mod config;
mod spec;
mod crypto;
mod wrap_key;
mod file;
mod card;
mod cmd_info;
@@ -38,6 +39,9 @@ enum Commands {
/// PIN
#[arg(long)]
pin: Option<String>,
/// SLOT
#[arg(long)]
slot: Option<String>,
},
/// Show file info
#[command(arg_required_else_help = true, short_flag = 'I')]
@@ -57,9 +61,9 @@ fn main() -> XResult<()> {
paths.iter().for_each(|f| information!("{:?}", f));
Ok(())
}
Commands::Decrypt { paths, pin } => {
Commands::Decrypt { paths, pin, slot } => {
for path in &paths {
match cmd_decrypt::decrypt(path, &pin) {
match cmd_decrypt::decrypt(path, &pin, &slot) {
Ok(_) => success!("Decrypt {} succeed", path.to_str().unwrap_or("N/A")),
Err(e) => failure!("Decrypt {} failed: {}", path.to_str().unwrap_or("N/A"), e),
}