EPassportNFCReader icon indicating copy to clipboard operation
EPassportNFCReader copied to clipboard

: net.sf.scuba.smartcards.CardServiceException: File not found, CAPDU exception

Open jonneymendoza opened this issue 4 years ago • 8 comments

Hi i grabbed your project an ran it on my Samsung S8 device and i get an exception when i try to do the NFC conact part on the app using my british passport.

the MRZ scanning seems to work but not the NFC

Full stacktrace below

2021-01-13 16:30:23.885 25172-28874/com.alimert.passportreader W/MainActivity: net.sf.scuba.smartcards.CardServiceException: File not found, CAPDU = 00A4020C02011D, RAPDU = 6A82 (SW = 0x6A82: FILE NOT FOUND)
        at org.jmrtd.protocol.ReadBinaryAPDUSender.checkStatusWordAfterFileOperation(ReadBinaryAPDUSender.java:218)
        at org.jmrtd.protocol.ReadBinaryAPDUSender.sendSelectFile(ReadBinaryAPDUSender.java:79)
        at org.jmrtd.DefaultFileSystem.sendSelectFile(DefaultFileSystem.java:321)
        at org.jmrtd.DefaultFileSystem.getFileInfo(DefaultFileSystem.java:272)
        at org.jmrtd.DefaultFileSystem.getSelectedPath(DefaultFileSystem.java:129)
        at net.sf.scuba.smartcards.CardFileInputStream.<init>(CardFileInputStream.java:60)
        at org.jmrtd.PassportService.getInputStream(PassportService.java:595)
        at com.alimert.passportreader.ui.MainActivity$ReadTask.doInBackground(MainActivity.java:250)
        at com.alimert.passportreader.ui.MainActivity$ReadTask.doInBackground(MainActivity.java:223)
        at android.os.AsyncTask$3.call(AsyncTask.java:378)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)```

jonneymendoza avatar Jan 13 '21 16:01 jonneymendoza

I think MRZ scanning is the problem. Sure it reads MRZ but extracted one of the passportNumber, birthDate and expirationDate values could be wrong. Could you please control these three values with writing log? https://github.com/alimertozdemir/EPassportNFCReader/blob/b7828a21eb637ced07526d84e37df793d5482254/app/src/main/java/com/alimert/passportreader/ui/MainActivity.java#L211

alimertozdemir avatar May 03 '21 20:05 alimertozdemir

I have the same issue, the problem isnt the MRZ, i am sure. I am trying to build in my own app and i have the same issue, but if i do the same in your app, all works ok. In my app, if i try, it's works but without image. I am writing logs, all seems ok

Redd1ntong avatar Jul 29 '21 11:07 Redd1ntong

Hello, @alimertozdemir, @Redd1ntong, did you eventually find the reason of the issue? Am facing it too and I'm already out of ideas.

ashpakouski avatar Mar 23 '22 17:03 ashpakouski

Any solution?

YesidMarin avatar Oct 31 '22 20:10 YesidMarin

@alimertozdemir This is not a MRZ issue. It looks like the app is trying to read EF 011D which corresponds to EF.CardSecurity, and it fails with 6A82 (File not found). Not all chips come with EF.CardSecurity, it is only mandatory if the chip supports PACE-CAM. The only EF that is mandatory for PACE is EF.CardAccess, which the app is not even using. This results in the app selecting the applet without doing proper PACE beforehand.

The code in question is the following: https://github.com/alimertozdemir/EPassportNFCReader/blob/f9bbbc4cc856d42fdc5736d13246344245bbcd53/app/src/main/java/com/alimert/passportreader/ui/MainActivity.java#L248-L261

I think that adding the code to read EF.CardAccess will solve the issue.

ElMostafaIdrassi avatar Feb 26 '23 21:02 ElMostafaIdrassi

Did you find a solution to the problem?? I replaced this line with real data but still the same problem

BACKeySpec bacKey = new BACKey("U2426****", "010***", "260***");

@alimertozdemir @alimertozdemir @jonneymendoza @YesidMarin @Redd1ntong

please if you have any idea or solution share with me

fuatebuzeynebKplus avatar Jun 10 '24 11:06 fuatebuzeynebKplus