tananaev / passport-reader

e-Passport NFC Reader Android app
329 stars 128 forks source link

Mutual authentication failed #7

Open DerEnderKeks opened 6 years ago

DerEnderKeks commented 6 years ago

When I'm trying to read my passport it says "Mutual authentication failed: expected length: 40 + 2, actual length: 2 (SW = 0x6985: CONDITIONS NOT SATI...".

tananaev commented 6 years ago

I would recommend to ask in JMRTD project. That's the library I'm using in this project to communicate with the passport chip.

shwetankb11 commented 6 years ago

Hello, Did you find the solution for this error, I am also facing the same problem. Thanks

DerEnderKeks commented 6 years ago

I switched to this app. It works flawless and even has OCR for the passport ID.

shwetankb11 commented 6 years ago

Thanks for quick response, I tried this application and it works fine but i need to implement it in my android application.

DerEnderKeks commented 6 years ago

I sadly can't help you with that as I only used the app to scan my passport.

shwetankb11 commented 6 years ago

No worries, Thanks

ad3bay0 commented 6 years ago

i have this same issue @shwetankb11 any solution yet?

shwetankb11 commented 6 years ago

Are u making your own application?

ad3bay0 commented 6 years ago

@shwetankb11 yeah i m making an android application that scans passport, i can read Nigerian passport(no BAC) perfectly but when i scan a British/Fininsh passport(BAC protected) i get the error you mentioned.

shwetankb11 commented 6 years ago

Go to playstore and search for Bondi passport, in the more section you will find the github project link, Try that if it works.

ad3bay0 commented 6 years ago

thanks would check it out.

RomainL972 commented 4 years ago

I usually get this error when the information I entered in the app (passport number, birth date and expiration date) are incorrect.

cihatkapusuz commented 3 years ago

Hello, i finally solved this problem on my app. I hope that will help you all, too. Once you set a timeout to your NfcA or NfcB depends on which one you use, it works pretty well if the informations about the card are correct. This was the only change that I have made.

isoDep.setTimeout(5000)

akeilox commented 3 years ago

@cihatkapusuz where did you set the isoDep timeout exactly in the code ?

cihatkapusuz commented 3 years ago

I am not able to post a snapshot of my code but I can say on the top of everything after defining my isoDep variable.

akeilox commented 3 years ago

I think the likely location is within

    private ReadTask(IsoDep isoDep, BACKeySpec bacKey) {
            //set timeout ?
            isoDep.setTimeout(5000);

            this.isoDep = isoDep;
            this.bacKey = bacKey;
        }
cihatkapusuz commented 3 years ago

Yes, something like this would help.

msgopi3 commented 3 years ago

Hi, Any update on this issue, Am trying to read a BRP card by using "Read ID card" button in the app. When I tap my ID card, I get this same error "Mutual authentication failed: expected length: 40 + 2, actual length: 2 (SW = 0x6985: CONDITIONS NOT SATI...".

YesidMarin commented 1 year ago

Any solution for this problem? I think that is only works on card ID, but on passport (some) require extras steps.

w-henderson commented 1 year ago

Hi, I managed to solve this by calling

passportService.sendSelectApplet(false);

just before calling doBAC in order to specify that the PACE secure channel has not been initialised.

LeeUsun commented 11 months ago

@shwetankb11 Thanks, it works

alexdu5711 commented 9 months ago

Work for me BACKey bacKey = new BACKey(documentNumber, dateOfBirth, dateOfExpiry); service.sendSelectApplet(false); //Important sinon erreur service.doBAC(bacKey);

EljackJoestar commented 1 day ago

Anyone solved the issue yet im trying to make it work on an emirates id and its giving the same error