0

I am trying to read a swiss insurance card.

First the Marster file is selected and then the EF.ID file is selected. When reading binary for the EF.ID datas, the response is correct once and only once. Afterward I always get a different data response that is translated as : fFInter1 MTCOS p 2.1

The second query is made over EF.AD once it is selected and the answer to the read binary is always correct.

I can add that when running the program from visual studio the problem never occurs and the apdu response is always correct. The problem occurs only when the application is installed and running as a desktop application.

I do not know why the response from the EF.ID is not always the same and what's the meaning of this "Inter1 MTCOS p 2.1".

INFO    -  >> Show card reader form
INFO    -  >> Card connected
INFO    -  >> Sequence processing
INFO    -  >> Select File
INFO    -  >> APDU command : Class=00 Ins=A4 P1=00 P2=00 P3=02 Data=3F00
INFO    -  >> APDU response : SW=9000
INFO    -  >> Select File
INFO    -  >> APDU command : Class=00 Ins=A4 P1=00 P2=00 P3=02 Data=2F06
INFO    -  >> APDU response : SW=9000
INFO    -  >> Read Binary
INFO    -  >> APDU command : Class=00 Ins=B0 P1=00 P2=00 P3=FF 
INFO    -  >> APDU response : SW=6282 Data=652F801147656E6472652C204672616EC3A76F697382083139373130313139830D373536353738313138303732318401010000000000000000000000000000000000000000000000000000000000000000000000 File=EF.ID
INFO    -  >> Select File
INFO    -  >> APDU command : Class=00 Ins=A4 P1=00 P2=00 P3=02 Data=2F07
INFO    -  >> APDU response : SW=9000
INFO    -  >> Read Binary
INFO    -  >> APDU command : Class=00 Ins=B0 P1=00 P2=00 P3=FF 
INFO    -  >> APDU response : SW=6282 Data=6532900243489105535749434192053031333834931438303735363031333834303034373432383734369408323032353036333000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 File=EF.AD
INFO    -  >> Sequence processed
INFO    -  >> APDU response count : 5
INFO    -  >> APDU Response 1 processing
INFO    -  >> APDU response status 9000
INFO    -  >> Response data is null
INFO    -  >> APDU Response 2 processing
INFO    -  >> APDU response status 9000
INFO    -  >> Response data is null
INFO    -  >> APDU Response 3 processing
INFO    -  >> APDU response status 6282
DEBUG   -  >> APDU response byte arr to string : 652F801147656E6472652C204672616EC3A76F697382083139373130313139830D373536353738313138303732318401010000000000000000000000000000000000000000000000000000000000000000000000
DEBUG   -  >> APDU response unicode : e/?Gendre, François?19710119? 7565781180721?                                   
INFO    -  >> APDU response cleaned : Gendre, François?19710119?7565781180721
INFO    -  >> Response file : EF.ID
INFO    -  >> fullname : Gendre, François
INFO    -  >> APDU Response porocessed
INFO    -  >> APDU Response 4 processing
INFO    -  >> APDU response status 9000
INFO    -  >> Response data is null
INFO    -  >> APDU Response 5 processing
INFO    -  >> APDU response status 6282
DEBUG   -  >> APDU response byte arr to string : 6532900243489105535749434192053031333834931438303735363031333834303034373432383734369408323032353036333000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
DEBUG   -  >> APDU response unicode : e2?CH?SWICA?01384?80756013840047428746?20250630                                           
INFO    -  >> APDU response cleaned : e2?CH?SWICA?01384?80756013840047428746?20250630
INFO    -  >> Response file : EF.AD
INFO    -  >> APDU Response porocessed
=====================================================================================================
DEBUG   -  >> localFilename C:\Users\François Gendre\AppData\Local\Temp\tmp60F4.tmp
INFO    -  >> Show card reader form
INFO    -  >> Card connected
INFO    -  >> Sequence processing
INFO    -  >> Select File
INFO    -  >> APDU command : Class=00 Ins=A4 P1=00 P2=00 P3=02 Data=3F00
INFO    -  >> APDU response : SW=9000
INFO    -  >> Select File
INFO    -  >> APDU command : Class=00 Ins=A4 P1=00 P2=00 P3=02 Data=2F06
INFO    -  >> APDU response : SW=9000
INFO    -  >> Read Binary
INFO    -  >> APDU command : Class=00 Ins=B0 P1=00 P2=00 P3=FF 
INFO    -  >> APDU response : SW=6282 Data=E010020204000202040002020400020204006617461502496E746572312020204D54434F53207020322E31 File=EF.ID
INFO    -  >> Select File
INFO    -  >> APDU command : Class=00 Ins=A4 P1=00 P2=00 P3=02 Data=2F07
INFO    -  >> APDU response : SW=9000
INFO    -  >> Read Binary
INFO    -  >> APDU command : Class=00 Ins=B0 P1=00 P2=00 P3=FF 
INFO    -  >> APDU response : SW=6282 Data=6532900243489105535749434192053031333834931438303735363031333834303034373432383734369408323032353036333000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 File=EF.AD
INFO    -  >> Sequence processed
INFO    -  >> APDU response count : 5
INFO    -  >> APDU Response 1 processing
INFO    -  >> APDU response status 9000
INFO    -  >> Response data is null
INFO    -  >> APDU Response 2 processing
INFO    -  >> APDU response status 9000
INFO    -  >> Response data is null
INFO    -  >> APDU Response 3 processing
INFO    -  >> APDU response status 6282
DEBUG   -  >> APDU response byte arr to string : E010020204000202040002020400020204006617461502496E746572312020204D54434F53207020322E31
DEBUG   -  >> APDU response unicode : ?    fFInter1   MTCOS p 2.1
INFO    -  >> APDU response cleaned : fFInter1   MTCOS p 2.1
INFO    -  >> Response file : EF.ID
INFO    -  >> fullname : fFInter1   MTCOS p 2.1
====================================================================================================
  • Please show us the code and full response / error conditions and include them into the Q by hitting [edit]. – Maarten Bodewes Nov 02 '22 at 15:06
  • I have added the log file created while reading the card. There are two attempts, the first one successful that returns the good value and a second one that does not return what is expected. the data is at the level of the "APDU Response 3 processing" log – Astrobod427 Nov 02 '22 at 16:53
  • 1
    There are two SELECT commands reading `CLA=00 INS=A4 P1=00 P2=00 P3=00 `. Isn't that something like SELECT MF? Why would you do that before reading a file? – Maarten Bodewes Nov 02 '22 at 17:21
  • I simplified the logs. Yes the first select is for the master file and the other select are for the other files that have to be queried and from which the binary read is done. In the two exemples (one when the response is ok and the other when it is not) the select file and read binary commands are definitely identical so what could cause this answer? – Astrobod427 Nov 02 '22 at 22:35
  • Have you compared how the question looks before and after your latest edit? – Maarten Bodewes Nov 02 '22 at 22:38
  • Sorry but I do not understand what you mean – Astrobod427 Nov 02 '22 at 22:47

0 Answers0