java mifare,JavaCard可以模拟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.

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.

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

Update to original question

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.

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?

解决方案

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 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) |

+-------------------------+ +-------------------------+

| ... | | ... |

+-------------------------+ +-------------------------+

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.

Edit (based on ErikM's remark):

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.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值