JavaCard可以模拟MIFARE Ultralight或NTAG NFC标签吗? [英] Can a JavaCard emulate a MIFARE Ultralight or NTAG NFC tag?

查看:192
本文介绍了JavaCard可以模拟MIFARE Ultralight或NTAG NFC标签吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个Java卡小程序来响应NFC读取器,就好像它是常规的MIFARE Ultralight或NTAG NFC标签一样.

I would like to write a Java Card applet that responds to an NFC reader as if it was a regular MIFARE Ultralight or NTAG NFC tag.

我知道MIFARE协议是专有协议,可能会有些困难,但是我肯定可以实现NTAG协议的仿真.

I am aware the MIFARE protocol is proprietary and may be a little more difficult but surely I should be able to achieve emulation of the NTAG protocol.

如果我符合NTAG规范并响应正确的APDU,那么我肯定可以模拟NTAG吗?

If I match the NTAG specification and respond to the correct APDUs then I can surely emulate an NTAG?

更新为原始问题

我认为我不正确地问了我原来的问题.我不希望模拟每个sé的特定标签.我实际上想做的是使用新的核心NFC API.请注意,据说该API支持类型1到5的标签.我希望能够编写一个Java Card applet,该applet可以在非接触式智能卡上运行并允许与智能手机进行(简单)通信.

I think I asked my original question incorrectly. I'm not looking to emulate a specific tag per sé. What I am actually trying to do is use a Java Card powered card to be able to supply dynamic information to a smartphone such as Android or Apple iPhone using the new Core NFC API. Note that this API is said to support tags of type 1 through 5. I would like to be able to write a Java Card applet that can run on a contactless smartcard and allow (simplex) communication with a smartphone.

我想我的问题是:如何确定来自核心NFC API的APDU的流量,以便编写可以适当响应的小程序?

I guess my question is: How can I determine the flow of APDU from the Core NFC API so that I can write an applet that will respond suitably?

推荐答案

否,这是不可能的. MIFARE Ultralight,NTAG和其他NFC Forum Type 2标签在ISO/IEC 14443-3A(也称为NFC-A)中定义的防冲突和成帧协议的基础上运行.

No, that's not possible. MIFARE Ultralight, NTAG, and other NFC Forum Type 2 tags operate on top of the anti-collision and framing protocols defined in ISO/IEC 14443-3A (also called NFC-A).

Java卡小程序(通常)使用APDU命令(ISO/IEC 7816-4中定义的协议层)进行通信. Java Card运行时环境仅将APDU命令传递给小程序.非接触式智能卡在ISO-DEP半双工传输协议(如ISO/IEC 14443-4中指定)的顶部交换这些APDU命令.反过来,此传输协议位于ISO/IEC 14443-3中定义的一种帧协议(也称为NFC-A和NFC-B)的顶部.

Java Card applets (in general) communicate using APDU commands (a protocol layer defined in ISO/IEC 7816-4). The Java Card run-time environment only passes APDU commands to applets. Contactless smartcards exchange these APDU commands on top of the ISO-DEP half duplex transmission protocol (as specified in ISO/IEC 14443-4). This transmission protocol, in turn, sits on top of one of the framing protocols defined in ISO/IEC 14443-3 (also called NFC-A and NFC-B).


+-------------------------+  +-------------------------+
| MIFARE Ultralight/NTAG  |  | Contactless Java Card   |
+-------------------------+  +-------------------------+

                             +-------------------------+
                             | Commands: APDUs         |
                             | (ISO/IEC 7816-4)        |
+-------------------------+  +-------------------------+
| Commands: Proprietary   |  | ISO-DEP                 |
| or NFC Forum Type 2ary  |  | (ISO/IEC 14443-4)       |
+-------------------------+  +-------------------------+
| Framing: NFC-A          |  | Framing: NFC-A or NFC-B |
| (ISO/IEC 14443-3 A)     |  | (ISO/IEC 14443-3 A/B)   |
+-------------------------+  +-------------------------+
|           ...           |  |          ...            |
+-------------------------+  +-------------------------+

因此,尽管这两种技术共享相同的协议层,但是Java Card小应用程序只能交换APDU命令,而不能直接控制许多较低的协议层.

Consequently, while both technologies share common protocol layers, Java Card applets can only exchange APDU commands and cannot control much of the lower protocol layers directly.

编辑(基于 ErikM的评论):

Edit (based on ErikM's remark):

虽然无法在Java Card上模拟NFC论坛2型标签(除非您的智能卡平台上将提供专用的硬件支持---而且我不认为这是当前存在的.),但是您可以轻松地模拟一个任何Java Card非接触式智能卡上的NFC论坛Type 4标签.因此,如果您的目标是模拟可向NDEF展示NDEF消息的NFC标签.智能手机,那么您可以采用这种方法.甚至有此类applet的开源实现,例如

While it's not possible to emulate NFC Forum Type 2 tags on Java Card (unless there would be dedicated hardware support on your smartcard platform --- And I don't think that this currently exists.), you could easily emulate an NFC Forum Type 4 tag on any Java Card contactless smartcard. So if your goal is to emulate an NFC tag that presents an NDEF message to e.g. a smartphone, then you could follow this approach. There is even open-source implementations of such applets, e.g.

  • https://github.com/promovicz/javacard-ndef
  • https://github.com/slomo/ndef-javacard

这篇关于JavaCard可以模拟MIFARE Ultralight或NTAG NFC标签吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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