AndyQ / NFCPassportReader

NFCPassportReader for iOS 13
MIT License
733 stars 235 forks source link

Sample app fails to read German passport #208

Open NickAtGit opened 3 months ago

NickAtGit commented 3 months ago

Hello, unfortunately I'm not able to read my passport. The MRZ is correct and passport works with other apps from the AppStore.

2024-04-08 3:56:24.2070 - Error reading tag: sw1 - 0x69, sw2 - 0x82
2024-04-08 3:56:24.2100 - reason: Security status not satisfied
2024-04-08 3:56:24.2100 - PACE Failed - falling back to BAC
2024-04-08 3:56:24.2250 - Starting Basic Access Control (BAC)
2024-04-08 3:56:24.3770 - Basic Access Control (BAC) - SUCCESS!
2024-04-08 3:56:24.3780 - Reading tag - COM
2024-04-08 3:56:24.4660 - Reading tag - DG14
2024-04-08 3:56:24.7650 - Performing Chip Authentication - number of public keys found - 2
2024-04-08 3:56:25.0790 - Restarting secure messaging using DESede encryption
2024-04-08 3:56:25.0810 - Reading tag - SOD
2024-04-08 3:56:25.6780 - Reading tag - DG1
2024-04-08 3:56:25.7660 - Reading tag - DG2
-[NFCTagReaderSession transceive:tagUpdate:error:]:893 Error Domain=NFCError Code=102 "Tag response error / no response" UserInfo={NSLocalizedDescription=Tag response error / no response, NSUnderlyingError=0x3032974b0 {Error Domain=nfcd Code=29 "Tag Error" UserInfo={NSLocalizedDescription=Tag Error, NSUnderlyingError=0x303297a80 {Error Domain=com.apple.nfstack Code=20 "No response from tag" UserInfo={NSLocalizedDescription=No response from tag}}}}}

Edit: Now I got it to work a few times. But the error is reproducible on my phone. The other apps from the store don't produce errors at all when reading my pass.

danydev commented 3 months ago

So, if I understand correctly, by just retrying multiple times you are able to make it work?.

Can you put logs with debug logs enabled? let reader = PassportReader(logLevel: .debug)

NickAtGit commented 3 months ago

Hi @danydev thanks for replying so quickly. I don't see an initializer for PassportReader(logLevel: .debug). In the sample app I am using version 2.1.1 of the package.

danydev commented 3 months ago

you're right that's the old way to enable log level, that's not needed right now, you should already see\filter all kind of logs in the IDE.

@AndyQ do you find this kind of issue interesting? I mean, if ReadId is able to not fail, it probably does something slightly different? What it could be? btw looks like the same issue reported here https://github.com/AndyQ/NFCPassportReader/issues/166

AndyQ commented 3 months ago

It is really interesting actually, and a little odd that it can read some of the items (so security and comms channels are setup correctly). The only thing I can really think of is maybe reading too quickly or too slowly (although not sure what I can do about that)?

I haven't yet though come across a passport that has this behaviour so I'm unable to test this out though.

danydev commented 3 months ago

@NickAtGit as you can see it's really hard to try debug this remotely. Can you scan like 6/7 times and post the full logs in separated files? It's a a bit a shot in the dark, but maybe, Andy can see something in the logs that could shed some ideas about tweaks to test out.

Also, what happens if you read only DG1, only DG2 and so on? Are you able to succesfully read them separately? e.g.

passportReader.readPassport(mrzKey: mrzKey, tags: [.COM, .DG1], completed: { (error) in
   ...
}