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

Change in APDU data & instructions due to some passports are giving error while scanning #180

Open
kmgoyani opened this issue May 3, 2023 · 6 comments

Comments

@kmgoyani
Copy link

kmgoyani commented May 3, 2023

I'm scanning the passport of Denmark. It is giving me a timeout error while NFC tag reading. I have solved that issue by changing APDU data & instructions in the TagReader.swift file & readCardAccess() method as below.

let cmd : NFCISO7816APDU = NFCISO7816APDU(instructionClass: 0x00, instructionCode: 0xA4, p1Parameter: 0x00, p2Parameter: 0x0C, data: Data([0x3f, 0x00, 0x30, 0x04]), expectedResponseLength: 256)

It works for me.

Please provide me access of the pull request.

@danydev
Copy link
Contributor

danydev commented Sep 5, 2023

@AndyQ it sounds like a low hanging fruit, what do you think?

@AndyQ
Copy link
Owner

AndyQ commented Sep 5, 2023

I'll take a look hopefully in the next day or so!

@AndyQ
Copy link
Owner

AndyQ commented Sep 8, 2023

Took a look this morning and unfortunately that breaks PACE on all my test passports.
It doesn't like the extra parameters - 0x30, 0x04.

I get 0x67 0x00 - Wrong length response

Going back a few PRs - we had a discussion about this when I was implementing PACE:
#44 (comment)

@danydev
Copy link
Contributor

danydev commented Sep 8, 2023

Those cases where something work in a document and fail in another are kind of scary,

I'm wondering, in those cases, is there the ability to try one way, and then fallback to the other in case of failure?

If this is possible, we could aim on safely\easily increasing the supported documents over time.

@AndyQ
Copy link
Owner

AndyQ commented Sep 11, 2023

I need to do some more testing but from previous experience, I typically, when you get a failure in a service, the passport often kills the connection and you have to restart then whole discovery phase again! (which is somewhat annoying).

Now I'm hoping that in this case, just trying to selecting the Master Card index with additional options (which may fail) may not do this but we'll see!

@danydev
Copy link
Contributor

danydev commented Sep 11, 2023

I see! In those other cases, where you have to restart the whole discovery phase, you also mean that he needs to do again the step where the passport is actually read, right? Damn that's pity.

Maybe, if this is the case, we could offer an API where the "alternative command" can be enabled somehow, so that a developer that knows the "type of the document" (i.e. issuer nationality in practice) could set this on the options to be able to read that kind of document (I'm thinking on cases where people already do ocr for the MRZ and they could easily extract the issuer as well for this scope)

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

3 participants