v1.1.0, update openpgp-card versions
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use clap::{App, Arg, ArgMatches, SubCommand};
|
||||
use openpgp_card::DecryptMe;
|
||||
use openpgp_card::OpenPgp;
|
||||
use openpgp_card::crypto_data::Cryptogram;
|
||||
use rust_util::util_clap::{Command, CommandError};
|
||||
|
||||
pub struct CommandImpl;
|
||||
@@ -37,8 +38,14 @@ impl Command for CommandImpl {
|
||||
return simple_error!("cipher or cipher-base64 must assign one");
|
||||
};
|
||||
|
||||
let user = crate::pgpcardutil::get_card_user_sw1_82(pin)?;
|
||||
let text = user.decrypt(DecryptMe::RSA(&cipher_bytes))?;
|
||||
let mut card = crate::pgpcardutil::get_card()?;
|
||||
let mut pgp = OpenPgp::new(&mut card);
|
||||
let mut trans = opt_result!(pgp.transaction(), "Open card failed: {}");
|
||||
|
||||
opt_result!(trans.verify_pw1_user(pin.as_ref()), "User pin verify failed: {}");
|
||||
success!("User pin verify success!");
|
||||
|
||||
let text = trans.decipher(Cryptogram::RSA(&cipher_bytes))?;
|
||||
success!("Clear text HEX: {}", hex::encode(&text));
|
||||
success!("Clear text base64: {}", base64::encode(&text));
|
||||
success!("Clear text UTF-8: {}", String::from_utf8_lossy(&text));
|
||||
|
||||
Reference in New Issue
Block a user