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

NFC and ISO 7816 support #110

Open
1Dragoon opened this issue Nov 3, 2022 · 3 comments
Open

NFC and ISO 7816 support #110

1Dragoon opened this issue Nov 3, 2022 · 3 comments

Comments

@1Dragoon
Copy link

1Dragoon commented Nov 3, 2022

With the current implementation, it doesn't seem practical detect whether we're dealing with a yubikey via NFC, as the only way we can really do so is by looking at the reader name. But that doesn't work if it's over an NFC reader, which will have a different name under PCSC. I think the ideal way to do this would be to look at the card's ATR, which the current PCSC code doesn't support. I've added Windows support for that, (here: https://github.com/1Dragoon/piv-go) though I don't have a means of easily testing any support I add for other platforms.

Once the ATR is obtained, based on this:

http://ludovic.rousseau.free.fr/softwares/pcsc-tools/smartcard_list.txt

It looks like all yubikeys will have some variation of the word "yubikey" in the historical bytes field, sometimes with the first or last y omitted.

@ericchiang
Copy link
Collaborator

Sorry, I'm not super familiar with ATR

Are you looking for information returned by SCardStatus()? https://pcsclite.apdu.fr/api/group__API.html#gae49c3c894ad7ac12a5b896bde70d0382

Do you have a use case in mind for how you'd use this information? How would exposing this cause you to make different decisions in your application?

@1Dragoon
Copy link
Author

1Dragoon commented Nov 4, 2022

Yes that is correct, namely because the ATR is going to tell you what state the card is in, in addition to giving you hints as to what it even is. This is useful in situations where your card may be something other than a yubikey, such as another PIV device or maybe even a seos badge.

Please see the diff here:

master...1Dragoon:piv-go:master

@1Dragoon
Copy link
Author

1Dragoon commented Nov 4, 2022

Just added the unix side, works on linux, not sure about other platforms as I can't really test any of them. Submitted PR #111. Effectively this adds compatibility with using yubikeys over NFC, in addition to broader PIV compatibility, as we can ask the card whether it's a yubikey rather than asking the card reader.

@1Dragoon 1Dragoon changed the title ATR based yubikey detection NFC and ISO 7816 support Nov 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants