feat: update pgp

This commit is contained in:
2023-10-05 23:15:42 +08:00
parent 81c20a6872
commit 78824f279b
4 changed files with 14 additions and 9 deletions

View File

@@ -2,10 +2,10 @@ use std::collections::BTreeMap;
use clap::{App, Arg, ArgMatches, SubCommand};
use openpgp_card::crypto_data::Cryptogram;
use openpgp_card::OpenPgp;
use rust_util::{util_msg, XResult};
use rust_util::util_clap::{Command, CommandError};
use crate::pgpcardutil;
use crate::util::{base64_decode, base64_encode};
#[derive(Debug, Clone, Copy)]
@@ -61,8 +61,7 @@ impl Command for CommandImpl {
return simple_error!("cipher or cipher-base64 must assign one");
};
let card = crate::pgpcardutil::get_card()?;
let mut pgp = OpenPgp::new(card);
let mut pgp = pgpcardutil::get_openpgp_card()?;
let mut trans = opt_result!(pgp.transaction(), "Open card failed: {}");
opt_result!(trans.verify_pw1_user(pin.as_ref()), "User pin verify failed: {}");