Giter VIP home page Giter VIP logo

Comments (20)

AndyQ avatar AndyQ commented on August 11, 2024 1

Well... Apparently that will give you: (Extended try) sw - 0x67, sw2 - 0x00, and no data

and then (Normal try) sw - 0x69, sw2 - 0x88, and no data

So apparently not.

Thats a shame! Not quite sure what to do here really. I could add a flag to enable extended mode BUT you'd have to know that the passport supports/doesn't support that. I'll did a little more into JMRTD code and see if I can see what they did to solve this. I had a quick look thorugh and they had some functions in bouncy castle that could get certain info about the keys that I haven't yet figured out how to do (I'm sure its possible though).

from nfcpassportreader.

AndyQ avatar AndyQ commented on August 11, 2024 1

The doInternalAuthentication function is actually not working. Active Authentication (AA) is not being created.

Could you try with version 2.1.1 and see if that works for you (that doesn't enable extended read) and has been working for most passports (except newer Australian and probably other newer ones)?

from nfcpassportreader.

AndyQ avatar AndyQ commented on August 11, 2024 1

So what I've done for the moment is instead of enabling extended mode for AA by default, we now have an additional flag set on PassportReader init - useExtendedMode. Not ideal but will think more.

Also, as per #224 - We're now using OpenSSL 1.1.2300 which is a signed release and includes a privacy policy.

Currently main branch only,

from nfcpassportreader.

baskurtbey avatar baskurtbey commented on August 11, 2024 1

The latest update solved my problem, thank you. You saved me from a big issue; I had been researching it for a week. πŸ™β€οΈ

from nfcpassportreader.

AndyQ avatar AndyQ commented on August 11, 2024 1

It's definitely getting closer. I'm still not 100% happy as I do t yet know what passport support extended reads and which don't! It looks like some Chinese ones don't but I'm sure there are others too. So I can't yet say when you should use extended read or not. JMRTD does some best guesses based on key lengths BITBi haven't yet figured out how to replicate that in OpenSSL (JMRTD uses bouncycastle which has different APIs).

from nfcpassportreader.

rbrouwer avatar rbrouwer commented on August 11, 2024

Setting Expected Response Length to 231 on this line works for those documents as well. Guessing the extended format is not being liked.

from nfcpassportreader.

AndyQ avatar AndyQ commented on August 11, 2024

Thats really annoying! will have a re-think

from nfcpassportreader.

AndyQ avatar AndyQ commented on August 11, 2024

I've created a test branch - aa_test which makes the following changes:

  • passportReader.readPassport now takes in an optional PassportReaderOptions struct with various configuration options
  • Added option usePACEPolling - Switches to PACE Polling for detecting passports rather that iso14443
  • Active Authentication no longer always uses extended read
  • Instead, we first try with standard 256 byte read, and if fails, tries extended read
    • Note this is currently untested as I don't have any passports that require extended read
  • Sample app updated to show new options

If anyone can test this branch to see if it works fine that would be great!

from nfcpassportreader.

rbrouwer avatar rbrouwer commented on August 11, 2024

I do not believe that would work. Some documents (like that Australian passport in #194) will actually return OK with a partial signature (cutting off whatever did not fit). The implementation in aa_test would return that response and not go for an extended read.

This of course would work fine for this one document I now mentioned in this issue, but that other one would again break.

from nfcpassportreader.

AndyQ avatar AndyQ commented on August 11, 2024

Hmmm thats a good point. Wonder if it would work the other way round? try first with extended read and if that failed then try standard? I've pushed up a small change to try that

from nfcpassportreader.

rbrouwer avatar rbrouwer commented on August 11, 2024

That will not work for my document as you would need to handle the NFCPasswordReaderError.ResponseError thrown from TagReader.send(). This Chinese document returns sw - 0x69, sw2 - 0x88 (SM data objects incorrect) when doing the extended version first.

from nfcpassportreader.

AndyQ avatar AndyQ commented on August 11, 2024

Ah of course - small change! - currently doesn't check the error, just retries non-extended - any better?

I'm really interested if the passport will allow the normal read after the extended read fails!

from nfcpassportreader.

rbrouwer avatar rbrouwer commented on August 11, 2024

Well... Apparently that will give you:
(Extended try)
sw - 0x67, sw2 - 0x00, and no data

and then
(Normal try)
sw - 0x69, sw2 - 0x88, and no data

So apparently not.

from nfcpassportreader.

furkanisik000 avatar furkanisik000 commented on August 11, 2024

?

from nfcpassportreader.

baskurtbey avatar baskurtbey commented on August 11, 2024

@rbrouwer Did you solve the problem

from nfcpassportreader.

baskurtbey avatar baskurtbey commented on August 11, 2024

The doInternalAuthentication function is actually not working. Active Authentication (AA) is not being created.

from nfcpassportreader.

baskurtbey avatar baskurtbey commented on August 11, 2024

Hello, I tried but unfortunately there was an issue. It doesn't decode, most likely. The ID is a Turkish ID and it should normally be supported.

from nfcpassportreader.

baskurtbey avatar baskurtbey commented on August 11, 2024

It works seamlessly on Android using JMRTD.

from nfcpassportreader.

danydev avatar danydev commented on August 11, 2024

@AndyQ looks like it's working for @baskurtbey maybe it's time for a release? ;)

Also, when we should use the flag for extended? Which passports as far as you know require it to read them correctly?

from nfcpassportreader.

tomgi avatar tomgi commented on August 11, 2024

@AndyQ for what it's worth, ICAO specifies in https://www.icao.int/publications/documents/9303_p11_cons_en.pdf that

Note.β€” It should be noted that when using key lengths exceeding 1 848 bits (if Secure Messaging with 3DES is used) / 1 792 bits (if Secure Messaging with AES is used) in Active Authentication with Secure Messaging, Extended Length APDUs MUST be supported by the eMRTD chip and the Inspection System.

For Australian R-series EPassports, DG14 includes id-PACE-ECDH-GM-AES-CBC-CMAC-256 (0.4.0.127.0.7.2.2.4.2.4) as the only supported PACE algorithm.
This is a 256-byte key, so based on that we know the chip MUST support extended length APDUs.

Logs from here are:

doPace - inpit parameters
paceOID - 0.4.0.127.0.7.2.2.4.2.4
parameterSpec - 933
mappingType - Generic Mapping
agreementAlg - ECDH
cipherAlg - AES
digestAlg - SHA-256
keyLength - 256

from nfcpassportreader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.