读取NFC Mifare卡与恩智浦读卡器库 [英] Reading a NFC Mifare card with NXP Reader Library

查看:585
本文介绍了读取NFC Mifare卡与恩智浦读卡器库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想阅读使用NFC读写器库中的Mifare卡超轻的内容。

我与NFC全新的,我使用这github上库启动。

在此回购的code可以判断哪个类型的卡检测(的Mifare,超轻的Mifare ...)并读取卡的UID。我为了阅读的Mifare卡超轻的内容添加了这个$​​ C $ C:

  uint8_t有bBufferReader [96];
memset的(bBufferReader,'\\ 0',0x60的);
PH_CHECK_SUCCESS_FCT(状态,phalMful_Read(安培; alMful,4,bBufferReader));
INT I;
对于(i = 0; I< 96;我++){
   的printf(%02X,bBufferReader [I]);
}

我有一个包含文本Hello World的卡片,当我读它,这块code上面打印以下字节:

<$p$p><$c$c>0103A010440312D1010E5402667248650000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

所以,我读了一些东西,我的卡,但是没有一个Hello World的痕迹
文字。

可能失去了一些东西(可能是一个很大的东西,或者有希望,少了一些)。任何帮助将是巨大的!

修改

所以我做了一些良好的进展。 MIFARE超轻包含16页的4个字节,0 - 3是用于内部使用(序列号,锁定等)和4 - 15是用于用户数据。我现在可以读我的牌的内容,但是,短短的问题是:

我在读,其中包含一个URL,www.google.com卡,这里是我得到了什么:

  03 0F D1 01  - &GT;第1页,4个字节的非文本数据,不知道它是什么
0B 55 01 67 - &GT;第2页,第3个字节的非文本数据,然后在1个字节用于G
6F 6F 67 6C - &GT;第3页,第4个字节为oogl
65 2E 63 6F - &GT;第4页,4个字节为e.co
6D FE 00 00 - &GT;第6页,为M1个字节,1个字节,因为我不知道
00 00 00 00 - &GT;其他网页都只是空
00 00 00 00
00 00 00 00
00 00 00 00
00 00 00 00
00 00 00 00
00 00 00 00

所以我有7个字节的数据+我的网址,google.com+ 1个字节 FE

我找不到这些是什么7 preFIX字节+ 1这个尾随字节...

再次编辑

好了它,它的NDEF消息格式。


解决方案

是的,它是NDEF格式!

  03 NDEF消息
0F长度
记录1
D1 - MB,ME,SR,TNF =NFC论坛众所周知的类型
01型长
0B有效载荷长度
55类型 - U(Abbrivati​​on为URL)67 6F 6F 67 6C 65 2E 63 6F 6D(google.com)记录2
FE终结者NDEF

I'm trying to read the content of a Mifare Ultralight card using the NFC Reader Library.

I'm totally new with NFC and I'm using this github repository to start.

The code in this repo allows to detect which type of card is detected (Mifare, Mifare ultralight ...) and read the UID of the card. I added this code in order to read the content of a Mifare ultralight card:

uint8_t bBufferReader[96];
memset(bBufferReader, '\0', 0x60);
PH_CHECK_SUCCESS_FCT(status, phalMful_Read(&alMful, 4, bBufferReader));
int i;
for(i = 0; i < 96; i++){
   printf("%02X", bBufferReader[i]);
}

I have a card that contains the text "Hello world" and when I read it, the piece of code above print the following bytes:

0103A010440312D1010E5402667248650000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

So I'm reading some stuff out of my card, however there is no traces of a "Hello world" text.

Probably missing something (might be a big something or, hopefully, a little something). Any help would be great !

Edit

So I made some good progress. Mifare ultralight contains 16 pages of 4 bytes, 0 - 3 are for internal usage (serial number, lock etc ...) and 4 - 15 are for user data. I can now read the content of my cards, however, just a few question remains:

I'm reading a card that contains an URL, www.google.com, here is what I got:

03 0F D1 01  -> Page 1, 4 bytes of non text data, not sure what it is 
0B 55 01 67  -> Page 2, 3 bytes of non text data, then 1 bytes for the "g"
6F 6F 67 6C  -> Page 3, 4 bytes for "oogl"
65 2E 63 6F  -> Page 4, 4 bytes for "e.co"
6D FE 00 00  -> Page 6, 1 byte  for "m", 1 byte for I don't know
00 00 00 00  -> Other pages are just empty
00 00 00 00 
00 00 00 00 
00 00 00 00 
00 00 00 00 
00 00 00 00 
00 00 00 00 

So I have got 7 bytes of data + my url, "google.com" + 1 byte FE

I can't find what are these 7 prefix bytes + this 1 trailing byte...

Edit again

Ok got it, it's the NDEF message format.

解决方案

Yes it is NDEF format!

03 NDEF Message
0F length
Record 1
D1 - MB, ME, SR, TNF="NFC Forum well-known type"
01 Type length
0B Payload length
55 Type - "U"(Abbrivation for URL)  

67  6F 6F 67 6C  65 2E 63 6F 6D (google.com)

Record 2
FE Terminator NDEF

这篇关于读取NFC Mifare卡与恩智浦读卡器库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆