Closed saberzakhama closed 7 years ago
It seems like a Czech-based ID card. I think I remember that some countries may have different ICAO rules on how to compute the check digits. Please see the exception properties, it should contain the exact position in the MRZ string, which check digit exactly is incorrect.
Unfortunately I do not have access to the spec for Czech ID cards. If you do have the access, please fix it. If you don't, you can employ a workaround and disable that particular verification check in the java sources.
Just yesterday I wrote MRZ parser in javascript. My implementation is based purely on the specification and I couldn't find any info about deviations in czech passport. Provided MRZ string works for me.
Edit: I just tried this library and it also works.
It seems that there is a bug in the class MRZParser
if you replace the checkDigit function with this /**
It should work. The failure its that its doing an OR instead of an AND if (digit != checkDigit || (checkDigit != FILLER && checkDigit != '0' && digit == '0') ) { throw new MrzParseException("Check digit verification failed for " + fieldName + ": expected " + digit + " but got " + checkDigit, mrz, new MrzRange(col, col + 1, row), format); }
According to Wikipedia https://en.wikipedia.org/wiki/Machine-readable_passport "Check digit over digits 29–42 (may be < if all characters are <)" which if you have an OR this condition its going to fall into thrown the exception.
You can always go to http://www.consilium.europa.eu/prado/en/prado-start-page.html to use real documents for test
There is another bug in the function parseName(MrzRange range), this is the fix
/**
Thanks! Could you please fork the repo and create a merge request? I'll then review the request and merge it.
Hi, did you have the chance to validate the pull request?
Hi, I'm sorry but I don't see any pull request in my repo. You need to fork this repo, clone that fork, commit there, push there, then create pull request towards this repo. I'm sure there are good tutorials on how to do this.
Ok,I will repeat the process this week. obviously something went wrong.
There are other cases when check digit validation fails, e.g. German & Irish passports have one digit at the end of the 2nd MRZ line. Anyway, I think it is better to continue the process even if the check digit validation fails. See my pull request #5
Thanks, merged. Should fix this issue, closing. Please reopen if the issue is still not fully closed.
when i pass some passports ther is an exception like "Check digit verification failed for nationality: expected 3 but got 6" and the mrz is P<CZESPECIMEN<<VZOR<<<<<<<<<<<<<<<<<<<<<<<<< 99003853<1CZE1101018M1207046110101111<<<<<94
and for many other passports I have the same issue