diff --git a/README.md b/README.md index 8187bcf..275bc4b 100644 --- a/README.md +++ b/README.md @@ -172,7 +172,7 @@ Yubico's [yubico-piv-tool], a C library/CLI program. The original library was licensed under a [2-Clause BSD License][BSDL], which this library inherits as a derived work. -Copyright (c) 2014-2022 Yubico AB, Tony Arcieri +Copyright (c) 2014-2023 Yubico AB, Tony Arcieri All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/cli/README.md b/cli/README.md index bbe3465..7e1a14f 100644 --- a/cli/README.md +++ b/cli/README.md @@ -43,7 +43,7 @@ For more information, please see [CODE_OF_CONDUCT.md][cc-md]. ## License -Copyright (c) 2014-2022 Yubico AB, Tony Arcieri +Copyright (c) 2014-2023 Yubico AB, Tony Arcieri All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/src/transaction.rs b/src/transaction.rs index 0ac156f..379aa9d 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -106,8 +106,8 @@ impl<'tx> Transaction<'tx> { /// Get YubiKey device serial number. pub fn get_serial(&self, version: Version) -> Result { match version.major { + // YK4 requires switching to the YK applet to retrieve the serial 4 => { - // YK4 requires switching to the yk applet to retrieve the serial let sw = Apdu::new(Ins::SelectApplication) .p1(0x04) .data(YK_AID) @@ -122,6 +122,7 @@ impl<'tx> Transaction<'tx> { let response = Apdu::new(0x01).p1(0x10).transmit(self, 0xFF)?; if !response.is_success() { + // TODO(tarcieri): still reselect the PIV applet in this case? error!( "failed retrieving serial number: {:04x}", response.status_words().code() @@ -143,8 +144,9 @@ impl<'tx> Transaction<'tx> { response.data().try_into() } + + // YK5 implements getting the serial as a PIV applet command (0xf8) 5 => { - // YK5 implements getting the serial as a PIV applet command (0xf8) let response = Apdu::new(Ins::GetSerial).transmit(self, 0xFF)?; if !response.is_success() { @@ -157,6 +159,8 @@ impl<'tx> Transaction<'tx> { response.data().try_into() } + + // Other versions unsupported _ => Err(Error::NotSupported), } }