Struct webauthn_authenticator_rs::nfc::Atr
source · pub struct Atr {
pub protocols: HashSet<u8>,
pub t1: Vec<u8>,
pub storage_card: bool,
pub card_issuers_data: Option<Vec<u8>>,
pub command_chaining: Option<bool>,
pub extended_lc: Option<bool>,
}nfc only.Expand description
ISO/IEC 7816-3 Answer-to-Reset and 7816-4 Historical Bytes parser.
This intentionally incomplete, and only supports a subset of the standards needed for compatibility with FIDO tokens.
References:
- “Answer-to-Reset”, ISO/IEC 7816-3:2005 §8.2
- “Historical bytes”, ISO/IEC 7816-4:2006 §8.1.1
- “ATR, Contactless Smart Cards”, PC/SC Specification Part 3, §3.1.3.2.3.1
- “ATR, Contactless Storage Cards”, PC/SC Specification Part 3, §3.1.3.2.3.2
Other resources:
Fields§
§protocols: HashSet<u8>Supported protocols (T=), specified in ISO/IEC 7816-3:2006 §8.2.3.
t1: Vec<u8>Historical bytes (T1 .. Tk), as specified in ISO/IEC 7816-4:2005 §8.1.1.
storage_card: boolIf true, this is a contactless storage card per
[PC/SC Specification][pcsc-spec] Part 3, §3.1.3.2.3.2, and Part 3
Supplemental Document.
Further clarification is available in the historical bytes
(Self::t1), but is beyond the scope of this module.
FIDO tokens should always return false.
card_issuers_data: Option<Vec<u8>>Card issuer’s data (ISO/IEC 7816-4:2005 §8.1.1.2.5). The structure of
this value is defined by the card issuer. This sometimes contains a
printable string identifying the card issuer (see
Self::card_issuers_data_str()).
command_chaining: Option<bool>Whether the card supports command chaining (ISO/IEC 7816-4:2005 §5.1.1.1). This allows sending commands longer than 255 bytes using only short form Lc.
If this value is set to None, the card did not provide a “card capabilities” value (ISO/IEC 7816-4:2005 §8.1.1.2.7).
extended_lc: Option<bool>Whether the card supports extended (3 byte) Lc and Le fields (ISO/IEC 7816-4:2005 §5.1) – which allows Nc (command data length) and Ne (maximum expected response length) values from 257 to 65536 bytes.
If this value is set to None, the card did not provide a “card
capabilities” value (§8.1.1.2.7), and therefore does not support
extended fields (§5.1).
FIDO v2.0 requires all NFC devices support short and extended length encoding.
See: ISO7816LengthForm
Implementations§
source§impl Atr
impl Atr
sourcepub fn card_issuers_data_str(&self) -> Option<&str>
pub fn card_issuers_data_str(&self) -> Option<&str>
Converts Self::card_issuers_data to a UTF-8 encoded string.
Returns None if Self::card_issuers_data is missing, or if it
contains invalid UTF-8.