feat: clean code
This commit is contained in:
@@ -5,7 +5,10 @@ use std::time::{Instant, SystemTime};
|
||||
|
||||
use clap::Args;
|
||||
use openpgp_card::crypto_data::Cryptogram;
|
||||
use rust_util::{debugging, failure, iff, information, opt_result, println_ex, simple_error, success, util_msg, util_size, warning, XResult};
|
||||
use rust_util::{
|
||||
debugging, failure, iff, information, opt_result, println_ex, simple_error, success,
|
||||
util_msg, util_size, warning, XResult,
|
||||
};
|
||||
use rust_util::util_time::UnixEpochTime;
|
||||
use x509_parser::prelude::FromDer;
|
||||
use x509_parser::x509::SubjectPublicKeyInfo;
|
||||
@@ -132,7 +135,7 @@ pub fn decrypt_single(config: &Option<TinyEncryptConfig>,
|
||||
None => "sha256",
|
||||
Some(algo) => algo.as_str(),
|
||||
};
|
||||
if cmd_decrypt.digest_file { DigestWrite::from_algo(digest_algorithm)?; } // QUICK CHECK
|
||||
if cmd_decrypt.digest_file { DigestWrite::from_algo(digest_algorithm)?; } // FAST CHECK
|
||||
|
||||
let selected_envelop = select_envelop(&meta, config)?;
|
||||
|
||||
@@ -363,7 +366,7 @@ fn try_decrypt_key_pgp(envelop: &TinyEncryptEnvelop, pin: &Option<String>) -> XR
|
||||
util_pgp::read_and_verify_openpgp_pin(&mut trans, pin)?;
|
||||
|
||||
let pgp_envelop = &envelop.encrypted_key;
|
||||
debugging!("PGP envelop: {}", &pgp_envelop);
|
||||
debugging!("PGP envelop: {}", pgp_envelop);
|
||||
let pgp_envelop_bytes = opt_result!(util::decode_base64(pgp_envelop), "Decode PGP envelop failed: {}");
|
||||
|
||||
let key = trans.decipher(Cryptogram::RSA(&pgp_envelop_bytes))?;
|
||||
|
||||
Reference in New Issue
Block a user