AndroidPassportReader
AndroidPassportReader copied to clipboard
Use readEF() as a reliable method to read Data Groups
First, thanks for your work. Reading the content of a data group as a byte array is a tricky thing. There are two things that this read must simultaneously satisfy:
- We must extract the bytes out of it (sometimes, none is extracted)
- The bytes that got extracted must be correct so that it's hash re-computation will match (sometimes the extracted bytes are incorrect)
Can you give a try if my readEF() method simultaneously satisfies the above criteria? This read or mismatch issue is also discussed here . Thanks amigo!
In PassportNFC.kt::verifyHash method, the below fid variable is not compatible when feed into getDG(dg: Int) method:
val fid = LDSFileUtil.lookupFIDByTag(LDSFileUtil.lookupTagByDataGroupNumber(dgNumber))
The getDG() always returns null causing the message below in the log:
W/PassportNFC: Skipping DG1 during HT verification because file could not be read.
W/PassportNFC: Skipping DG2 during HT verification because file could not be read.
W/PassportNFC: Skipping DG11 during HT verification because file could not be read.
W/PassportNFC: Skipping DG12 during HT verification because file could not be read.
W/PassportNFC: Skipping DG15 during HT verification because file could not be read.