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

Malformed SELECT FILE command? #54

Closed
martijnthe opened this issue Nov 29, 2018 · 3 comments · Fixed by #55
Closed

Malformed SELECT FILE command? #54

martijnthe opened this issue Nov 29, 2018 · 3 comments · Fixed by #55
Assignees
Labels

Comments

@martijnthe
Copy link
Contributor

Hi there, thanks for your library.

I'm having some trouble with an NXP NFC Tag type 4 tag (AID D2760000850101).
I inspected your code and compared it to another program that works correctly.

I noticed the code that sends the AID looks malformed:
https://github.com/pokusew/nfc-pcsc/blob/master/src/Reader.js#L736

According to this source, there should be an Lc field containing the length of the (AID) data, prior to the AID data. There's a field that has a comment Le but it's hard-coded to 5. Also, an empty / 00 byte (for the actual Le) seems to be missing.

What do you think?

@martijnthe martijnthe changed the title Malformed INS command? Malformed SELECT FILE command? Nov 29, 2018
@pokusew
Copy link
Owner

pokusew commented Dec 27, 2018

Hi @martijnthe,

I think you are right! 👍

I looked into the document you mentioned and the changes you described seem to be correct.

BTW – background info: I wrote the handle_Iso_14443_4_Tag method to work with an Android HCE demo. In that time, I didn't understand the SELECT FILE command properly, I just tried to make it work. Then I added it to the library in hope of being useful for someone. 😄

Thank you very much for fixing it! I really appreciate that. 🙂I accepted and merged your PR. Please answer my comment there.

Once the fixes are released into npm, please test if everything works for you and in case it doesn't reopen the issue. Thanks.


PS Thank you for the link to the free online copy of ISO 7816-4 standard. It's really hard to find relevant info about the standards. I'll be sure to add the corresponding links to the source code and to the documentation to make it clear where the commands come from, especially for beginners. 🙂


PSS Don't forget to star ⭐️my library, if you find it useful. 😃Thanks.

pokusew pushed a commit that referenced this issue Dec 27, 2018
* Fix malformed SELECT FILE command in `handle_Iso_14443_4_Tag()` (close #54)
* Add readClass option to `read()` method to allow specifying the class (instead of the hard-coded 0xFF class)
* Fix reading blocks beyond 255
@pokusew pokusew added the bug label Dec 27, 2018
@pokusew pokusew self-assigned this Dec 27, 2018
@martijnthe
Copy link
Contributor Author

You’re welcome :) thanks for accepting the fix!

@pokusew
Copy link
Owner

pokusew commented Dec 28, 2018

Hi @martijnthe, your fix along with many others shipped in v0.7.0. Please let me know if everything works for you as expected. 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants