Ebrahim Ghasemi
Ebrahim Ghasemi

Reputation: 6126

Weird behavior of smart card reader

I have a CRT-603-CZ1 smart card reader and I want to read 16 bytes of block 4 of a classic 1k Mifare contactless card. The authentication keys are the defualt values (i.e 0xFFFFFFFFFFFF). So I must send 3 commands to the reader as below :

  1. Load Key APDU command
  2. Authenticate APDU command
  3. Read Block Data

(The corresponding APDU commands are mentioned in the above manual.)

In order to send above APDU commands, I used OpenSCTool and you can see the result in the following:

OpenSCTool:> OSC.exe -s FF82000006FFFFFFFFFFFF -s FF860000050100046000 -s FFB000
0410
Using reader with a card: CREATOR CRT-603 (CZ1) CCR RF 0
Failed to connect to card: Card is invalid or cannot be handled

OpenSCTool:> OSC.exe -s FF82000006FFFFFFFFFFFF -s FF860000050100046000 -s FFB000
0410
Using reader with a card: CREATOR CRT-603 (CZ1) CCR RF 0
Sending: FF 82 00 00 06 FF FF FF FF FF FF
Received (SW1=0x90, SW2=0x00)
Sending: FF 86 00 00 05 01 00 04 60 00
Received (SW1=0x90, SW2=0x00)
Sending: FF B0 00 04 10
Received (SW1=0x90, SW2=0x00):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

OpenSCTool:> OSC.exe -s FF82000006FFFFFFFFFFFF -s FF860000050100046000 -s FFB000
0410
Using reader with a card: CREATOR CRT-603 (CZ1) CCR RF 0
Failed to connect to card: Card is invalid or cannot be handled

OpenSCTool:> OSC.exe -s FF82000006FFFFFFFFFFFF -s FF860000050100046000 -s FFB000
0410
Using reader with a card: CREATOR CRT-603 (CZ1) CCR RF 0
Sending: FF 82 00 00 06 FF FF FF FF FF FF
Received (SW1=0x90, SW2=0x00)
Sending: FF 86 00 00 05 01 00 04 60 00
Received (SW1=0x90, SW2=0x00)
Sending: FF B0 00 04 10
Received (SW1=0x90, SW2=0x00):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

OpenSCTool:> OSC.exe -s FF82000006FFFFFFFFFFFF -s FF860000050100046000 -s FFB000
0410
Using reader with a card: CREATOR CRT-603 (CZ1) CCR RF 0
Failed to connect to card: Card is invalid or cannot be handled

OpenSCTool:> OSC.exe -s FF82000006FFFFFFFFFFFF -s FF860000050100046000 -s FFB000
0410
Using reader with a card: CREATOR CRT-603 (CZ1) CCR RF 0
Sending: FF 82 00 00 06 FF FF FF FF FF FF
Received (SW1=0x90, SW2=0x00)
Sending: FF 86 00 00 05 01 00 04 60 00
Received (SW1=0x69, SW2=0x83)
Sending: FF B0 00 04 10
Received (SW1=0x69, SW2=0x82)

OpenSCTool:>

As you see above, I tried these there commands more than one time. but I didn't receive the same response.

Note that I don't change anything about the reader or card during repeating above command. Everything is fixed.

What's wrong?

Update:

Note that this reader has a tool that it works fine for the same APDU commands. Look:

enter image description here

These are contents of log section:

SCardTransmit...OK    Send Buffer : FF B0 00 04 10     Receive Buffer : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 

SCardTransmit...OK    Send Buffer : FF 82 00 00 06 FF FF FF FF FF FF   Receive Buffer : 90 00 

SCardTransmit...OK    Send Buffer : FF 86 00 00 05 01 00 04 60 00     Receive Buffer : 90 00

SCardTransmit...OK    Send Buffer : FF B0 00 04 10     Receive Buffer : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 

SCardTransmit...OK    Send Buffer : FF 82 00 00 06 FF FF FF FF FF FF   Receive Buffer : 90 00 

SCardTransmit...OK    Send Buffer : FF 86 00 00 05 01 00 04 60 00     Receive Buffer : 90 00

SCardTransmit...OK    Send Buffer : FF B0 00 04 10     Receive Buffer : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 

SCardTransmit...OK    Send Buffer : FF 82 00 00 06 FF FF FF FF FF FF   Receive Buffer : 90 00 

SCardTransmit...OK    Send Buffer : FF 86 00 00 05 01 00 04 60 00     Receive Buffer : 90 00

SCardTransmit...OK    Send Buffer : FF B0 00 04 10     Receive Buffer : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 

SCardTransmit...OK    Send Buffer : FF 82 00 00 06 FF FF FF FF FF FF   Receive Buffer : 90 00 

SCardTransmit...OK    Send Buffer : FF 86 00 00 05 01 00 04 60 00     Receive Buffer : 90 00

SCardTransmit...OK    Send Buffer : FF B0 00 04 10     Receive Buffer : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 

SCardTransmit...OK    Send Buffer : FF 82 00 00 06 FF FF FF FF FF FF   Receive Buffer : 90 00 

SCardTransmit...OK    Send Buffer : FF 86 00 00 05 01 00 04 60 00     Receive Buffer : 90 00

SCardTransmit...OK    Send Buffer : FF B0 00 04 10     Receive Buffer : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 

SCardTransmit...OK    Send Buffer : FF 82 00 00 06 FF FF FF FF FF FF   Receive Buffer : 90 00 

SCardTransmit...OK    Send Buffer : FF 86 00 00 05 01 00 04 60 00     Receive Buffer : 90 00

SCardTransmit...OK    Send Buffer : FF B0 00 04 10     Receive Buffer : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 

SCardTransmit...OK    Send Buffer : FF 82 00 00 06 FF FF FF FF FF FF   Receive Buffer : 90 00 

SCardTransmit...OK    Send Buffer : FF 86 00 00 05 01 00 04 60 00     Receive Buffer : 90 00

SCardTransmit...OK    Send Buffer : FF B0 00 04 10     Receive Buffer : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 

SCardTransmit...OK    Send Buffer : FF 82 00 00 06 FF FF FF FF FF FF   Receive Buffer : 90 00 

SCardTransmit...OK    Send Buffer : FF 86 00 00 05 01 00 04 60 00     Receive Buffer : 90 00

SCardTransmit...OK    Send Buffer : FF B0 00 04 10     Receive Buffer : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 

SCardTransmit...OK    Send Buffer : FF 82 00 00 06 FF FF FF FF FF FF   Receive Buffer : 90 00 

SCardTransmit...OK    Send Buffer : FF 86 00 00 05 01 00 04 60 00     Receive Buffer : 90 00

SCardTransmit...OK    Send Buffer : FF B0 00 04 10     Receive Buffer : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00 

SCardTransmit...OK    Send Buffer : FF 82 00 00 06 FF FF FF FF FF FF   Receive Buffer : 90 00 

SCardTransmit...OK    Send Buffer : FF 86 00 00 05 01 00 04 60 00     Receive Buffer : 90 00

SCardTransmit...OK    Send Buffer : FF B0 00 04 10     Receive Buffer : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00

As you see, all the response for different tries are equal.

So

  1. can I conclude "There is no problem with the reader, and there is a problem with the OpenSCTool"?
  2. How can I solve this issue?

Update 2:

I wrote a Python program using PySCard library to send above three commands in a row for 5 times. And all the five series have successful equal result (i.e 0x9000 for all 5*3 =15 commands). So it seems that there is problem with OpenSCTool.but I don't know what is the problem and why it respond like this.

Upvotes: 2

Views: 876

Answers (0)

Related Questions