NFC标签是否可以受到保护,避免被覆盖?

11

Nexus S可以写入NFC标签。 如何防止任何使用Nexus S的人覆盖您的标签?

例如,如果您在传单上放置了一个启动视频的NFC标签,那么是否有人可以使用Nexus S将其覆盖并替换为指向他网站的链接?

我是初学者,只是想了解一下NFC,请多多关照!

4个回答

8

许多标签类型都支持写保护,有些是全局的,而其他更复杂的标签则通过标签内存区域实现。

当您在Android NFC应用程序中检测到您的标签时,您可以获取一个Tag对象,并读取和写入标签,包括保护它免受进一步的写入。

这些都在Android开发者网站上的NFC类的开发者文档中描述。

例如,如果您正在高级别上工作并且正在读/写Ndef消息:

  1. Setup an intent filter (in code or manifest) so you detect Ndef or NDefFormatable tags. You can get a Tag object from the Intent passed to you (in onCreate() or onNewIntent()).

    Tag tag = intent.getParcelableExtra( NfcAdapter.EXTRA_TAG );
    
  2. From your Tag try to get an Ndef tag object from the intent.

  3. If successful in getting an Ndef object from the tag, then check it is writable, check it has enough space, write to it and then use the makeReadOnly() of Ndef....

  4. If getting an Ndef object failed (exception) then you will need to format the Tag first....so... get an NdefFormattable object from the detected Tag and write a message to it and protect it, using the formatReadOnly(NdefMessage firstMessage), or just format it and then continue with code to get Ndef ...

  5. If you can't get an NdefFormattable object then something is seriously wrong, as that was what you requested in your filter. Formatting might fail if it is read-only already.

一旦您理解了如何通过“标签技术”(包括NdefFormatableNdef)设置IntentFilter并从基本标签获取这些对象以执行不同操作,开发者文档就不太困难。


足够好以被选为答案吗? :-) - Andrew Mackenzie

1

如果我将NFC标签设置为只读,然后有人读取该标签并制作了一个副本。我们如何保护这些类型的标签,以便没有人可以制作副本标签。 - Innovation
1
我认为无法确保没有其他人复制您的数据。例如,如果您在标记中使用URL作为内容,并且有人读取了该数据,则没有任何阻止他们使用相同数据编码新标记的方法。 - Software.Developer

1
几乎所有的NFC标签都可以通过锁定位进行保护,您可以使用诸如NXP TagWriter、TaskLauncher等应用程序编写带有只读选项的NFC标签。请注意,如果标签是只读的,则无法再次重写。有关应用程序或NFC标签,请访问geenfc网站了解详情。

1

是的,你可以写保护(大多数)标签,防止其他人覆盖你的内容。如果你只想写一个标签,一个好用的安卓应用是NXP tagwriter,它具有多种编码选项和写保护选项。

如果你想让只有你控制标签的内容,请尝试NFCLabels tag manager应用程序。你的标签内容存储在“云”中,你通过账户访问你的标签。因此,你可以写保护标签,使Joe Schmoe无法破坏你的内容,但你仍然可以根据需要自由更新你的标签。它还提供了一些基本的参与分析功能。他们的YouTube视频展示了它的工作原理(请见上面的链接)。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接