Implement get_firmware_version (probably YubiKey specific)
This commit is contained in:
parent
9930e7d420
commit
9de79477b9
4 changed files with 31 additions and 1 deletions
|
@ -267,6 +267,11 @@ impl<'a> Open<'a> {
|
|||
self.card_app.get_algo_info()
|
||||
}
|
||||
|
||||
/// Firmware Version, YubiKey specific (?)
|
||||
pub fn firmware_version(&mut self) -> Result<Vec<u8>> {
|
||||
self.card_app.get_firmware_version()
|
||||
}
|
||||
|
||||
// ----------
|
||||
|
||||
pub fn get_pub_key(
|
||||
|
|
|
@ -66,6 +66,11 @@ pub(crate) fn get_algo_list() -> Command {
|
|||
get_data(&[0xFA])
|
||||
}
|
||||
|
||||
/// GET Firmware Version (yubikey specific?)
|
||||
pub(crate) fn get_firmware_version() -> Command {
|
||||
Command::new(0x00, 0xF1, 0x00, 0x00, vec![])
|
||||
}
|
||||
|
||||
/// GET RESPONSE
|
||||
pub(crate) fn get_response() -> Command {
|
||||
Command::new(0x00, 0xC0, 0x00, 0x00, vec![])
|
||||
|
|
|
@ -233,6 +233,17 @@ impl CardApp {
|
|||
Ok(Some(ai))
|
||||
}
|
||||
|
||||
/// Firmware Version (YubiKey specific (?))
|
||||
pub fn get_firmware_version(&mut self) -> Result<Vec<u8>> {
|
||||
let resp = apdu::send_command(
|
||||
self.card_client(),
|
||||
commands::get_firmware_version(),
|
||||
true,
|
||||
)?;
|
||||
|
||||
Ok(resp.data()?.into())
|
||||
}
|
||||
|
||||
/// SELECT DATA "select a DO in the current template"
|
||||
/// (e.g. for cardholder certificate)
|
||||
pub fn select_data(
|
||||
|
|
|
@ -283,11 +283,20 @@ fn print_status(ident: Option<String>, verbose: bool) -> Result<()> {
|
|||
// FIXME: add General key info; login data; KDF setting
|
||||
|
||||
if verbose {
|
||||
if let Some(ai) = open.algorithm_information()? {
|
||||
// Algorithm information (list of supported algorithms)
|
||||
if let Ok(Some(ai)) = open.algorithm_information() {
|
||||
println!();
|
||||
println!("Supported algorithms:");
|
||||
println!("{}", ai);
|
||||
}
|
||||
|
||||
// YubiKey specific (?) firmware version
|
||||
if let Ok(ver) = open.firmware_version() {
|
||||
let ver =
|
||||
ver.iter().map(u8::to_string).collect::<Vec<_>>().join(".");
|
||||
|
||||
println!("Firmware Version: {}", ver);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
Loading…
Reference in a new issue