feat: update yubikey to v0.8
This commit is contained in:
@@ -10,9 +10,10 @@ use rand::rngs::OsRng;
|
||||
use rust_util::util_clap::{Command, CommandError};
|
||||
use rust_util::util_msg;
|
||||
use yubikey::{PinPolicy, YubiKey};
|
||||
use yubikey::certificate::PublicKeyInfo;
|
||||
use yubikey::piv::{AlgorithmId, decrypt_data, metadata, RetiredSlotId, SlotId};
|
||||
|
||||
use crate::pivutil::get_algorithm_id;
|
||||
|
||||
pub struct CommandImpl;
|
||||
|
||||
impl Command for CommandImpl {
|
||||
@@ -108,20 +109,19 @@ impl Command for CommandImpl {
|
||||
}
|
||||
}
|
||||
if let Some(public_key) = &meta.public {
|
||||
match public_key {
|
||||
PublicKeyInfo::Rsa { algorithm, pubkey } => {
|
||||
failure_and_exit!("RSA not supported, {:?}, {:?}", algorithm, pubkey);
|
||||
let algorithm_id = opt_result!(get_algorithm_id(&public_key), "Get algorithm id failed: {}");
|
||||
match algorithm_id {
|
||||
AlgorithmId::Rsa1024 | AlgorithmId::Rsa2048 | AlgorithmId::EccP384 => {
|
||||
failure_and_exit!("Not supported algorithm: {:?}", algorithm_id);
|
||||
}
|
||||
PublicKeyInfo::EcP256(pubkey) => {
|
||||
if json_output {
|
||||
json.insert("pk_point_hex", hex::encode(pubkey.as_bytes()));
|
||||
} else {
|
||||
information!("EC-P256, {}", hex::encode(pubkey.as_bytes()));
|
||||
AlgorithmId::EccP256 => {
|
||||
match algorithm_id {
|
||||
AlgorithmId::EccP256 => if let Some(public) = &meta.public {
|
||||
json.insert("pk_point_hex", hex::encode(public.subject_public_key.raw_bytes()));
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
PublicKeyInfo::EcP384(pubkey) => {
|
||||
failure_and_exit!("EC-P384 not supported, {}", hex::encode(pubkey.as_bytes()));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user