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

Error reading tag: sw1 - 62, sw2 - 82 - reason: End of file/record reached before reading Le bytes #42

Closed
douglasg opened this issue Feb 11, 2020 · 9 comments

Comments

@douglasg
Copy link

With version 1.0.7 it works, with versions 1.0.8 to 1.0.10 I get the following error messages:

Starting Basic Access Control (BAC)
BAC Successful
2020-02-11 13:18:09.655779+0100 Identity Reader[3574:1702514] [CoreNFC] 00000002 834bd800 -[NFCTagReaderSession setAlertMessage:]:92  (null)
Reading tag - COM
2020-02-11 13:18:09.701659+0100 Identity Reader[3574:1702514] [CoreNFC] 00000002 834bd800 -[NFCTagReaderSession setAlertMessage:]:92  (null)
Expected response length: 22
Error reading tag: sw1 - 62, sw2 - 82 - reason: End of file/record reached before reading Le bytes
2020-02-11 13:18:09.720678+0100 Identity Reader[3574:1702514] [CoreNFC] 00000002 834bd800 -[NFCTagReaderSession setAlertMessage:]:92  (null)
ERROR - End of file/record reached before reading Le bytes
Reading tag - COM
Error reading tag: sw1 - 69, sw2 - 88 - reason: SM data objects incorrect
2020-02-11 13:18:09.741806+0100 Identity Reader[3574:1702453] [CoreNFC] 00000002 834bd800 -[NFCTagReaderSession setAlertMessage:]:92  (null)
ERROR - SM data objects incorrect
Starting Basic Access Control (BAC)
BAC Successful
2020-02-11 13:18:09.812785+0100 Identity Reader[3574:1702514] [CoreNFC] 00000002 834bd800 -[NFCTagReaderSession setAlertMessage:]:92  (null)
Reading tag - COM
2020-02-11 13:18:09.861595+0100 Identity Reader[3574:1702514] [CoreNFC] 00000002 834bd800 -[NFCTagReaderSession setAlertMessage:]:92  (null)
Expected response length: 22
Error reading tag: sw1 - 62, sw2 - 82 - reason: End of file/record reached before reading Le bytes
2020-02-11 13:18:09.882241+0100 Identity Reader[3574:1702498] [CoreNFC] 00000002 834bd800 -[NFCTagReaderSession setAlertMessage:]:92  (null)
ERROR - End of file/record reached before reading Le bytes
Reading tag - COM
Error reading tag: sw1 - 69, sw2 - 88 - reason: SM data objects incorrect
2020-02-11 13:18:09.904574+0100 Identity Reader[3574:1702514] [CoreNFC] 00000002 834bd800 -[NFCTagReaderSession setAlertMessage:]:92  (null)
ERROR - SM data objects incorrect
Starting Basic Access Control (BAC)

this repeats endlessly

Affected version: > 1.0.7
Document: Passport from spain

@AndyQ
Copy link
Owner

AndyQ commented Feb 11, 2020

Could you please try the latest version (currently 1.0.10) - There were some fixes in 1.0.9 that may well have fixed this.

@douglasg
Copy link
Author

Could you please try the latest version (currently 1.0.10) - There were some fixes in 1.0.9 that may well have fixed this.

Yes, I have also tested 1.0.10, with the same result, and then I gradually went down from that version and the last one that works is 1.0.7

@AndyQ
Copy link
Owner

AndyQ commented Feb 11, 2020

OK, could you please test the following - let me know if that works:

V1.0.10 - TagReader.swift line 294 - change:
expectedResponseLength : 256
to:
expectedResponseLength : Int(readAmount)

I have a horrible feeling that your passport doesn't handle the unknown amount of data to be read command (256) but could you confirm that that change fixes the issue?

@douglasg
Copy link
Author

expectedResponseLength : Int(readAmount)

I can confirm that this fixed the problem

@AndyQ
Copy link
Owner

AndyQ commented Feb 12, 2020

@douglasg I've created a branch - eofreached with a potential fix. Basically I'm first trying to read an arbitary amount of data (which should fail with your passport). At this point, I drop down to reading smaller chunks.

So you should see the first SOD read fail, it will then redo BAC and retry again which hopefulyl will work.

Could you please test and let me know?

@SaliienkoOleksandr
Copy link

expectedResponseLength : Int(readAmount)

I can confirm that this fixed the problem

I also had such problem. Int(Amount) fixed it.

@SaliienkoOleksandr
Copy link

Branch - eofreached also works good.

@douglasg
Copy link
Author

@AndyQ Sorry for the late feedback but I have now tested the branch eofreached and it works

@AndyQ
Copy link
Owner

AndyQ commented Feb 18, 2020

@douglasg, @SaliienkoAleksandr - Thanks for testing this! I'll merge it into master and it will be in the next release

@AndyQ AndyQ closed this as completed Feb 18, 2020
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