feat: v1.13.14
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -519,7 +519,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "card-cli"
|
name = "card-cli"
|
||||||
version = "1.13.13"
|
version = "1.13.14"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes-gcm-stream",
|
"aes-gcm-stream",
|
||||||
"authenticator 0.3.1",
|
"authenticator 0.3.1",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "card-cli"
|
name = "card-cli"
|
||||||
version = "1.13.13"
|
version = "1.13.14"
|
||||||
authors = ["Hatter Jiang <jht5945@gmail.com>"]
|
authors = ["Hatter Jiang <jht5945@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ use rust_util::util_clap::{Command, CommandError};
|
|||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
use rust_util::XResult;
|
use rust_util::XResult;
|
||||||
use crate::{cmdutil, hmacutil, pbeutil, util};
|
use crate::{cmdutil, hmacutil, pbeutil, util};
|
||||||
|
use crate::pinutil::get_pin;
|
||||||
|
|
||||||
pub struct CommandImpl;
|
pub struct CommandImpl;
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ impl Command for CommandImpl {
|
|||||||
fn subcommand<'a>(&self) -> App<'a, 'a> {
|
fn subcommand<'a>(&self) -> App<'a, 'a> {
|
||||||
SubCommand::with_name(self.name())
|
SubCommand::with_name(self.name())
|
||||||
.about("YubiKey HMAC encrypt")
|
.about("YubiKey HMAC encrypt")
|
||||||
.arg(Arg::with_name("plaintext").long("plaintext").short("t").takes_value(true).required(true).help("Plaintext"))
|
.arg(Arg::with_name("plaintext").long("plaintext").short("t").takes_value(true).required(true).help("Plaintext, @@PIN_ENTRY@@ means read from pin entry"))
|
||||||
.arg(Arg::with_name("password").long("password").short("P").takes_value(true).help("Password"))
|
.arg(Arg::with_name("password").long("password").short("P").takes_value(true).help("Password"))
|
||||||
.arg(cmdutil::build_with_pbe_encrypt_arg())
|
.arg(cmdutil::build_with_pbe_encrypt_arg())
|
||||||
.arg(cmdutil::build_double_pin_check_arg())
|
.arg(cmdutil::build_double_pin_check_arg())
|
||||||
@@ -31,6 +32,14 @@ impl Command for CommandImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let text = sub_arg_matches.value_of("plaintext").unwrap().to_string();
|
let text = sub_arg_matches.value_of("plaintext").unwrap().to_string();
|
||||||
|
let text = if text == "@@PIN_ENTRY@@" {
|
||||||
|
match get_pin(None) {
|
||||||
|
None => return simple_error!(""),
|
||||||
|
Some(text) => text,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
text
|
||||||
|
};
|
||||||
let mut pin_opt = sub_arg_matches.value_of("password").map(|p| p.to_string());
|
let mut pin_opt = sub_arg_matches.value_of("password").map(|p| p.to_string());
|
||||||
let ciphertext = do_encrypt(&text, &mut pin_opt, sub_arg_matches)?;
|
let ciphertext = do_encrypt(&text, &mut pin_opt, sub_arg_matches)?;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user