NFCPassportReader icon indicating copy to clipboard operation
NFCPassportReader copied to clipboard

Incomplete inferOID

Open typelogic opened this issue 3 years ago • 9 comments

The current implementation of inferOID looks incomplete. The 9303_p11_cons_en.pdf seems to describe the complete listing.

How do we approach to correctly infer the OID when ChipAuthenticationInfo is missing? The JMRTD's inferChipAuthenticationOIDfromPublicKeyOID method is also incomplete.

typelogic avatar Mar 26 '21 08:03 typelogic

Not sure what you mean by incomplete. The ChipAuthenticationInfo contains the details of what implementation should be used. Some passports for some reason don't include this so there is no way of knowing which is actually used, so we need to take a guess. There are two different types: DH and ECDSA, and within them you can use both 3DES and AES based encryption. If AES is used, then there are different key lengths.

However, however the Object ID for the Public Key only tells us that we are using either DH or ECDSA so we guess for the rest and based on the passports I've seen, in these cases they are all 3DES based so these are the ones I pick (as does JMRTD).

However, if there is a more complete way of guessing then I'd really like to know!

AndyQ avatar Mar 26 '21 11:03 AndyQ

I have one remote (not mine) epassport that failed on Chip Authentication using JMRTD's infer method. What do you think of looping through each until it succeeds?

typelogic avatar Mar 30 '21 05:03 typelogic

Would be interested to know what the type it actually was using was! If you are able to share the DG14 element and also the nationality of that passport that may be useful (not sure though).

The only issue with try each one if we are inferring, then it would probably break the secure session - passports tend to abort the session on an error with no warning which means that you would need to re-establish BAC each time adding a fair bit of complexity.

AndyQ avatar Mar 30 '21 09:03 AndyQ

I'm able to grab DG14 here.

typelogic avatar Mar 31 '21 11:03 typelogic

Would be interested to know what the type it actually was using was! If you are able to share the DG14 element and also the nationality of that passport that may be useful (not sure though).

The only issue with try each one if we are inferring, then it would probably break the secure session - passports tend to abort the session on an error with no warning which means that you would need to re-establish BAC each time adding a fair bit of complexity.

According to an ICAO protocol specification, it won't harm the state of the secure messaging on failed Chip Authentication attempt.

typelogic avatar Apr 01 '21 07:04 typelogic

From this ICAO spec, isn't epassports with missing ChipAuthenticationInfo be considered deviants? However, he was able to do CA using ReadID so I wonder how ReadID did it.

typelogic avatar Apr 01 '21 08:04 typelogic

I just tested using JMRTD that looping through each possible oid does not reset the secure messaging, until it finds the correct oid and is able to do a successful doEACCA(). In light of this result and what is stated here, I think I'll stick on my exhaustive looping technique rather than choosing one. For example, other possible actual value of OID is cited here.

typelogic avatar Apr 05 '21 09:04 typelogic

If you want to submit a pull request I'm happy to see if I can get this tested on some of the passports I've found that also have the missing ChipAutheniticationInfo with a view to implementing it in a future version if all works ok.

AndyQ avatar Apr 05 '21 09:04 AndyQ

@typelogic I'm curious which country passports did have this problem?

danydev avatar Feb 04 '23 16:02 danydev