Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support full Yubico OATH AID #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/authenticator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ impl<'l> Credential<'l> {

impl<T> iso7816::App for Authenticator<T> {
fn aid(&self) -> iso7816::Aid {
iso7816::Aid::new(&crate::YUBICO_OATH_AID)
iso7816::Aid::new_truncatable(&crate::YUBICO_OATH_AID, crate::YUBICO_OATH_AID_TRUNCATED_LEN)
}
}

Expand Down
9 changes: 4 additions & 5 deletions src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,10 @@ impl<'l, const C: usize> TryFrom<&'l iso7816::Command<C>> for Command<'l> {
impl<'l, const C: usize> TryFrom<&'l Data<C>> for Select<'l> {
type Error = Status;
fn try_from(data: &'l Data<C>) -> Result<Self, Self::Error> {
// info_now!("comparing {} against {}", hex_str!(data.as_slice()), hex_str!(crate::YUBICO_OATH_AID));
Ok(match data.as_slice() {
crate::YUBICO_OATH_AID => Self { aid: data },
_ => return Err(Status::NotFound),
})
if crate::YUBICO_OATH_AID.starts_with(data.as_slice()) {
return Ok(Self { aid: data});
}
Err(Status::NotFound)
}
}

3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ pub mod state;
pub const YUBICO_RID: [u8; 5] = hex!("A000000 527");
// pub const YUBICO_OTP_PIX: [u8; 3] = hex!("200101");
// pub const YUBICO_OTP_AID: &[u8] = &hex!("A000000527 2001 01");
pub const YUBICO_OATH_AID: &[u8] = &hex!("A000000527 2101");// 01");
pub const YUBICO_OATH_AID: &[u8] = &hex!("A000000527 2101 01");
pub const YUBICO_OATH_AID_TRUNCATED_LEN: usize = 7;

// class AID(bytes, Enum):
// OTP = b'\xa0\x00\x00\x05\x27 \x20\x01'
Expand Down