Open GoogleCodeExporter opened 9 years ago
Hello,
Did you tried to use a real mifare card ? Because, I did and I saw that
perfectly works: it fails with:
nfc_initiator_transceive_bytes: Mifare Authentication Failed
Authentication failed with KeyA, reconfiguring ...
Next, could you provide a full log produced with this command line, please:
LIBNFC_LOG_LEVEL=3 ./sfoc
Thanks
Original comment by romu...@libnfc.org
on 14 Feb 2013 at 7:13
Hi Romuald,
many thanks. I am observing something a bit more strange.
1. I have tried a *real* Mifare 1k/4k with 'nfc-mfclassic' from libnfc [1] and
it works as expected ('real-mifare.mfd' dump attached). Keys for all sectors
are either FF-FF-FF-FF-FF-FF or 00-00-00-00-00-00.
2. Then I tried 'sfoc' with 'LIBNFC_LOG_LEVEL=3' (attached 'real-mifare.log')
[2] on the *real* Mifare. I have modified 'sfoc.c' slightly (new 'sfoc.c'
attached) so that it attempts key-A authentication with FF-FF-FF-FF-FF-FF and
key-B authentication with 00-00-00-00-00-00. If you take a look at my
'real-mifare.mfd' dump (produced with 'nfc-mfclassic'), you'll find sector-0
has FF-FF-FF-FF-FF-FF as key-A and 00-00-00-00-00-00 as key-B. But both key-A
and key-B authentication fails in sfoc/libnfc this time!
------
xxd real-mifare.mfd | head -4
0000000: cd70 ce52 2108 0400 6263 6465 6667 6869 .p.R!...bcdefghi
0000010: ffff ffff ffff ff07 8069 ffff ffff ffff .........i......
0000020: ffff ffff ffff ff07 8069 ffff ffff ffff .........i......
0000030: ffff ffff ffff ff07 8069 0000 0000 0000 .........i......
------
3. I have tried to read the *emulated* Mifare 4k [3]:
- with libnfc: authentication with key-A seems to succeed. But *reading* data fails. (attached emulated-mifare.log with LIBNFC_LOG_LEVEL=3)
- with ProxMark3: and I can read sector 0 with key-A as FF-FF-FF-FF-FF-FF. I have not collected the ProxMark3 traces yet. But I can provide them if you want.
[1] nfc-mfclassic r a real-mifare.mfd
[2] LIBNFC_LOG_LEVEL=3 ./sfoc 2>&1 1 | tee real-mifare.log
[3] LIBNFC_LOG_LEVEL=3 ./sfoc 2>&1 1 | tee emulated-mifare.log
Original comment by gsbabil
on 15 Feb 2013 at 4:17
Attachments:
Hi Romuald,
more information. So far I have tried two emulated Mifare 1k/4k cards with
libnfc as listed below:
- Emulated Mifare 4k through Android
- Emulated Mifare 1k from dual-interfaced Paypass card
They both exhibit the exact same problem. On both of the emulated cards, my
authentication succeeds with FF-FF-FF-FF-FF-FF key (I think this is erroneous).
But then I can't perform any "MC_READ" with libnfc. Attached are the my
"paypass-mifare.log" and "paypass-mifare.mfd" containing LIBNFC_LOG_LEVEL=3 and
Mifare dump produced with "nfc-mfclassic".
Original comment by gsbabil
on 15 Feb 2013 at 5:25
Attachments:
I think I got it.
Your tags are ISO14443-4 A compliant and you want to use them only at
ISO14443-3 level so you have to disable automatic jump to ISO14443-4A
communication protocol.
So before selecting tag, you have to use:
pn53x_set_property_bool(pnd, NP_AUTO_ISO14443_4, false)
Original comment by romu...@libnfc.org
on 15 Feb 2013 at 8:31
Hi Romuald,
many thanks for your suggestion.
I modified "sfoc.c" with a new function "force_iso14443_a()" which sets
"NP_AUTO_ISO14443_4" to "false" and forces ISO14443_A. The good news is that
now I can authenticate against sector 0 and read block 0. But all other blocks
(1, 2 and 3) in sector 0 remain unreadable. I went through the captured log
using "LIBNFC_LOG_LEVEL=3 ./sfoc" and it shows "Chip error" on read attempt for
blocks 2, 3 and 4 on sector 0. The same applies for all other blocks and
sectors. For example on sector 1 block 4, authentication succeeds but reading
fails with "Chip error: "Invalid Received Frame" (13), returned error: "RF
Transmission Error" (-20))". Please have a look.
I am attaching:
- modified sfoc.c and mfoc.h
- modified make_sfoc.sh (you may have to change $libnfc_path inside)
- emulated-mifare.log with LIBNFC_LOG_LEVEL=3
P.S.
Interestingly, if I remember correctly, I had the same issue with the firmware
revision 653 on ProxMark. I could read sector 0 block 0 but nowhere else.
-----------------------------------------
void force_iso14443_a(nfc_device *pdi) {
if (pn53x_set_property_bool(pdi, NP_AUTO_ISO14443_4, false)){
nfc_perror(pdi, "pn53x_set_property_bool failed on: NP_AUTO_ISO14443_4");
}
if (pn53x_set_property_bool(pdi, NP_FORCE_ISO14443_A, true)){
nfc_perror(pdi, "pn53x_set_property_bool failed on: NP_FORCE_ISO14443_A");
}
if (pn53x_set_property_bool(pdi, NP_FORCE_SPEED_106, true)){
nfc_perror(pdi, "pn53x_set_property_bool failed on: NP_FORCE_SPEED_106");
}
}
-----------------------------------------
Original comment by gsbabil
on 21 Feb 2013 at 8:43
Attachments:
Original issue reported on code.google.com by
gsbabil
on 11 Feb 2013 at 7:51Attachments: