feat: enc/dec status line
This commit is contained in:
@@ -8,7 +8,7 @@ use std::time::Instant;
|
||||
use clap::Args;
|
||||
use openpgp_card::crypto_data::Cryptogram;
|
||||
use openpgp_card::OpenPgp;
|
||||
use rust_util::{debugging, failure, information, opt_result, simple_error, success, util_term, warning, XResult};
|
||||
use rust_util::{debugging, failure, iff, information, opt_result, simple_error, success, util_msg, util_term, warning, XResult};
|
||||
use x509_parser::prelude::FromDer;
|
||||
use x509_parser::x509::SubjectPublicKeyInfo;
|
||||
use yubikey::piv::{AlgorithmId, decrypt_data, RetiredSlotId, SlotId};
|
||||
@@ -96,7 +96,9 @@ pub fn decrypt_single(path: &PathBuf, pin: &Option<String>, slot: &Option<String
|
||||
let mut file_out = File::create(path_out)?;
|
||||
|
||||
let start = Instant::now();
|
||||
util_msg::print_lastline(&format!("Decrypting file: {}{} ...", path_display, iff!(meta.compress, " [compressed]", "")));
|
||||
let _ = decrypt_file(&mut file_in, &mut file_out, &key, &nonce, meta.compress)?;
|
||||
util_msg::clear_lastline();
|
||||
let encrypt_duration = start.elapsed();
|
||||
debugging!("Encrypt file: {} elapsed: {} ms", path_display, encrypt_duration.as_millis());
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ use std::time::Instant;
|
||||
use clap::Args;
|
||||
use flate2::Compression;
|
||||
use rsa::Pkcs1v15Encrypt;
|
||||
use rust_util::{debugging, failure, information, opt_result, simple_error, success, warning, XResult};
|
||||
use rust_util::{debugging, failure, information, opt_result, simple_error, success, util_msg, warning, XResult};
|
||||
|
||||
use crate::{util, util_ecdh};
|
||||
use crate::compress::GzStreamEncoder;
|
||||
@@ -148,7 +148,9 @@ fn encrypt_single(path: &PathBuf, envelops: &[&TinyEncryptConfigEnvelop], cmd_en
|
||||
opt_result!(file_out.write_all(&encrypted_meta_bytes), "Write meta failed: {}");
|
||||
|
||||
let start = Instant::now();
|
||||
util_msg::print_lastline(&format!("Encrypting file: {} ...", path_display));
|
||||
encrypt_file(&mut file_in, &mut file_out, &key, &nonce, cmd_encrypt.compress, &cmd_encrypt.compress_level)?;
|
||||
util_msg::clear_lastline();
|
||||
let encrypt_duration = start.elapsed();
|
||||
debugging!("Encrypt file: {} elapsed: {} ms", path_display, encrypt_duration.as_millis());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user