feat: v1.4.1

This commit is contained in:
2023-03-14 23:09:55 +08:00
parent 60847e8edf
commit 8a19502400
14 changed files with 37 additions and 25 deletions

View File

@@ -1,6 +1,7 @@
use clap::{App, Arg, ArgMatches, SubCommand};
use rust_util::util_clap::{Command, CommandError};
use yubikey::{PinPolicy, TouchPolicy, YubiKey};
use rust_util::util_msg;
use yubikey::{piv, PinPolicy, TouchPolicy, YubiKey};
use yubikey::piv::{AlgorithmId, SlotId};
pub struct CommandImpl;
@@ -16,7 +17,7 @@ impl Command for CommandImpl {
fn run(&self, _arg_matches: &ArgMatches, sub_arg_matches: &ArgMatches) -> CommandError {
let json_output = sub_arg_matches.is_present("json");
if json_output { rust_util::util_msg::set_logger_std_out(false); }
if json_output { util_msg::set_logger_std_out(false); }
warning!("This feature is not works");
let pin = opt_value_result!(sub_arg_matches.value_of("pin"), "User pin must be assigned");
@@ -24,7 +25,7 @@ impl Command for CommandImpl {
let mut yk = opt_result!(YubiKey::open(), "YubiKey not found: {}");
opt_result!(yk.verify_pin(pin.as_bytes()), "YubiKey verify pin failed: {}");
let public_key_info = opt_result!(yubikey::piv::generate(&mut yk,SlotId::Signature, AlgorithmId::Rsa2048,
let public_key_info = opt_result!(piv::generate(&mut yk,SlotId::Signature, AlgorithmId::Rsa2048,
PinPolicy::Default, TouchPolicy::Default), "Generate key failed: {}");
success!("Generate key success: {:?}", public_key_info);