Implement --identity command

This commit is contained in:
Jack Grigg
2021-01-01 21:12:52 +00:00
parent babe64da42
commit 7a527b2be6
7 changed files with 287 additions and 2 deletions
+12 -1
View File
@@ -4,7 +4,7 @@ use yubikey_piv::{
Key, YubiKey,
};
use crate::PLUGIN_NAME;
use crate::{p256::Recipient, yubikey::Stub, PLUGIN_NAME};
const POLICY_EXTENSION_OID: &[u64] = &[1, 3, 6, 1, 4, 1, 41482, 3, 8];
@@ -111,3 +111,14 @@ pub(crate) fn extract_name_and_policies(
}
})
}
pub(crate) fn print_identity(stub: Stub, recipient: Recipient, created: &str) {
let recipient = recipient.to_string();
if !console::user_attended() {
eprintln!("Recipient: {}", recipient);
}
println!("# created: {}", created);
println!("# recipient: {}", recipient);
println!("{}", stub.to_string());
}