2

Based on this article, i'm trying to emulate mifare card managing APDU on android.According to the APDU receive, my application should answer the right APDU, thus simulating the mifare behaviour.

with rfidiot.py, reading a mifare card give me :

>  FF CA 00 00 00
<  CD EA 7D 2B 90 0 
    Tag ID: CDEA7D2B
    ATR: 3B8F8001804F0CA000000306030001000000006A

  Setting Mifare Key A: FFFFFFFFFFFF

  Authenticating to sector 00 with Mifare Key A (FFFFFFFFFFFF)

>  FF 82 20 00 06 FF FF FF FF FF FF
<  []  90 0 
>  FF 88 00 00 60 00
<  []  90 0 
    OK

  Dumping data blocks 01 to 01:

>  FF 88 00 01 60 00
<  []  90 0 
>  FF B0 00 01 01
<  []  6C 10
>  FF B0 00 01 10
<  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 0 
    01: 00000000000000000000000000000000 ................

With my app simulating the card i got a wrong comportment:

>  FF CA 00 00 00
<  08 F0 82 65 90 0 
    Tag ID: 08F08265
    ATR: 3B80800101

  Setting Mifare Key A: FFFFFFFFFFFF

  Authenticating to sector 00 with Mifare Key A (FFFFFFFFFFFF)

>  FF 82 20 00 06 FF FF FF FF FF FF
<  []  90 0 
>  FF 88 00 00 60 00
<  []  90 0 
    OK

  Dumping data blocks 01 to 01:

>  FF 88 00 01 60 00
<  []  90 0 
>  FF B0 00 01 01
<  []  69 81
    Failed: Command incompatible with file structure

An error appear on FF B0 00 01 01 APDU command. And i don't know where the 6981 APDU command comes from..

Does someone can help me on this "bug" ?

Michael Roland
  • 39,663
  • 10
  • 99
  • 206
Lite
  • 161
  • 4
  • 14

1 Answers1

2

It is not possible what you are trying to do... What @NikolayElenkov has done is emulate a ISO 7816-4 compliant card. MIFARE Classic is not ISO 7816-4 compliant (it does not use APDU commands and responses for communication). In fact, it is not even ISO 14443-4 compliant: it uses proprietary encryption on top of ISO 14443-3.

The fact that the communication looks like APDUs from the reader side, is because your reader strips off all encryption before it passes the data on and wraps that data inside "virtual" APDUs. In that way, MIFARE cards can be used with software that can only deal with ISO 7816-4 compliant cards.

NFC guy
  • 10,151
  • 3
  • 27
  • 58
  • just writing this comment in hope that you might have a minute to take a look at my question about NFCF http://stackoverflow.com/q/17990618/2474385 Thank you. – Jake Graham Arnold Aug 01 '13 at 09:54
  • Dear @NFC guy , Could you please have a glance at my question: http://stackoverflow.com/questions/32842718/selecting-df-dedicated-file-in-smart-card-return-error-6981 ? – Hosein Aqajani Dec 01 '15 at 07:54