feat: v1.10.16

This commit is contained in:
2025-01-12 10:12:14 +08:00
parent d27f0d5f83
commit c48493f892
4 changed files with 9 additions and 3 deletions

2
Cargo.lock generated
View File

@@ -487,7 +487,7 @@ dependencies = [
[[package]] [[package]]
name = "card-cli" name = "card-cli"
version = "1.10.15" version = "1.10.16"
dependencies = [ dependencies = [
"authenticator 0.3.1", "authenticator 0.3.1",
"base64 0.21.7", "base64 0.21.7",

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "card-cli" name = "card-cli"
version = "1.10.15" version = "1.10.16"
authors = ["Hatter Jiang <jht5945@gmail.com>"] authors = ["Hatter Jiang <jht5945@gmail.com>"]
edition = "2018" edition = "2018"

View File

@@ -2,6 +2,7 @@ use clap::{App, Arg, ArgMatches, SubCommand};
use der_parser::ber::BerObjectContent; use der_parser::ber::BerObjectContent;
use pem::Pem; use pem::Pem;
use rust_util::util_clap::{Command, CommandError}; use rust_util::util_clap::{Command, CommandError};
use rust_util::util_msg;
use yubikey::{Key, YubiKey}; use yubikey::{Key, YubiKey};
use yubikey::piv::{AlgorithmId, sign_data}; use yubikey::piv::{AlgorithmId, sign_data};
@@ -25,6 +26,8 @@ impl Command for CommandImpl {
} }
fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError { fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError {
util_msg::set_logger_std_out(false);
let namespace_opt = sub_arg_matches.value_of("namespace"); let namespace_opt = sub_arg_matches.value_of("namespace");
let namespace = match namespace_opt { let namespace = match namespace_opt {
None => return simple_error!("Namespace required"), None => return simple_error!("Namespace required"),

View File

@@ -6,6 +6,7 @@ use base64::engine::general_purpose::STANDARD;
use base64::Engine; use base64::Engine;
use clap::{App, Arg, ArgMatches, SubCommand}; use clap::{App, Arg, ArgMatches, SubCommand};
use rust_util::util_clap::{Command, CommandError}; use rust_util::util_clap::{Command, CommandError};
use rust_util::util_msg;
use yubikey::piv::AlgorithmId; use yubikey::piv::AlgorithmId;
use yubikey::{Key, YubiKey}; use yubikey::{Key, YubiKey};
@@ -21,6 +22,8 @@ impl Command for CommandImpl {
} }
fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError { fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError {
util_msg::set_logger_std_out(false);
let slot = opt_value_result!(sub_arg_matches.value_of("slot"), "--slot must assigned, e.g. 82, 83 ... 95, 9a, 9c, 9d, 9e"); let slot = opt_value_result!(sub_arg_matches.value_of("slot"), "--slot must assigned, e.g. 82, 83 ... 95, 9a, 9c, 9d, 9e");
let ca = sub_arg_matches.is_present("ca"); let ca = sub_arg_matches.is_present("ca");
let mut yk = opt_result!(YubiKey::open(), "YubiKey not found: {}"); let mut yk = opt_result!(YubiKey::open(), "YubiKey not found: {}");
@@ -81,7 +84,7 @@ impl Command for CommandImpl {
let ssh_pub_key_sha256 = sha256_bytes(&ssh_pub_key); let ssh_pub_key_sha256 = sha256_bytes(&ssh_pub_key);
information!("SSH key SHA256: {} (base64)", STANDARD.encode(&ssh_pub_key_sha256)); information!("SSH key SHA256: {} (base64)", STANDARD.encode(&ssh_pub_key_sha256));
information!("SSH key SHA256: {} (hex)", hex::encode(&ssh_pub_key_sha256)); information!("SSH key SHA256: {} (hex)", hex::encode(&ssh_pub_key_sha256));
println!(); eprintln!();
println!( println!(
"{}ecdsa-sha2-{} {} Yubikey-PIV-{}", "{}ecdsa-sha2-{} {} Yubikey-PIV-{}",