我怎样才能保护MIFARE经典标签包含NDEF消息? [英] How can I protect a Mifare Classic Tag that contains a NDEF message?

查看:389
本文介绍了我怎样才能保护MIFARE经典标签包含NDEF消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这很容易保护的Mifare超轻与Android,还有就是 Ndef.makeReadonly()方法的。但MIFARE经典标签返回 Ndef.canMakeReadonly()==假,所以这是不可能的。我听说,人们可以作出这样的标签只读或者至少用钥匙通过设置a或b键保护它。

It's easy to protect a Mifare Ultralight with Android, there is the Ndef.makeReadonly() method for that. But Mifare Classic tags return Ndef.canMakeReadonly() == false, so this is not possible. I heard that one can make such a tag readonly or at least protect it with a key by setting the a or b keys.

有此methid在MifareClassic科技: authenticateSectorWithKeyB(INT sectorIndex,字节[]键)

There's this methid in MifareClassic tech: authenticateSectorWithKeyB(int sectorIndex, byte[] key)

有谁知道这是否可以用来做一个NDEF消息MIFARE经典标记为只读?或者,我怎么回事,可以写一个NDEF消息到标记,然后以某种方式将其锁定对新写?

Does anyone know if this can be used to make a ndef message on a mifare classic tag read-only? Or how else could I write a ndef message onto the tag and then somehow lock it against new writes?

推荐答案

它使用身份验证方法是可行的。

It is possible using the authenticate methods.

首先,这里是数据表的MIFARE经典4K:

First, here is the datasheet for the Mifare Classic 4k:

http://www.nxp.com/documents/data_sheet/MF1S703x.pdf

你是重要的章节:

  • 3.6存储器组织
  • 在3.6.3部门拖车

在短期写保护的工作原理是这样的:

In short a write protection works like this:

的MIFARE经典分为每4 * 16字节扇区(只适用于第一个1K左右...较高块是有点​​不同,但多数民众赞成在规范文件)。这64个字节16个是用于认证/保护。对于该卡的每一个部门,你做到以下几点:

The Mifare Classic is divided into sectors of 4*16 bytes each (only applies to the first 1k or so... the higher blocks are a bit different, but thats documented in the spec). Of these 64 bytes 16 are used for authentication/protection. For each sector of the card you do the following:

  1. 验证使用科亚部门
  2. 读取扇区尾。
  3. 修改部门拖车的访问位。
  4. 写扇区尾回卡。

在科亚值的Mifare经典的:

The KeyA values for Mifare Classics are:

字节[] KEY_DEFAULT =     {(字节)0xFF的,(字节)0xFF的,(字节)0xFF的,(字节)0xFF的,(字节)0xFF的,(字节)为0xFF};

byte[] KEY_DEFAULT = {(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF,(byte)0xFF};

有关未格式化,刚出厂卡。

For unformatted, factory fresh cards.

字节[] KEY_MIFARE_APPLICATION_DIRECTORY =     {(字节)0XA0,(字节)0xA1,(字节)0xA2,(字节)0xA3执行,(字节)0xA4,(字节)0xA5的};

byte[] KEY_MIFARE_APPLICATION_DIRECTORY = {(byte)0xA0,(byte)0xA1,(byte)0xA2,(byte)0xA3,(byte)0xA4,(byte)0xA5};

有关该卡的第一扇区

字节[] KEY_NFC_FORUM =
  {(字节)0xD3,(字节)0xF7,(字节)0xD3,(字节)0xF7,(字节)0xD3,(字节)0xF7};

byte[] KEY_NFC_FORUM =
{(byte)0xD3,(byte)0xF7,(byte)0xD3,(byte)0xF7,(byte)0xD3,(byte)0xF7};

对于所有其他部门。

重要:你必须写回原来的科亚钥匙卡。如果这些从卡上面显示的键不同将不会NDEF合了。

Important: You have to write back the original KeyA keys to the card. If these differ from the keys shown above the card will not be Ndef compliant anymore.

有关修改访问位,你有两个选择:

For the modified access bits you have two choices:

  1. 仅启用Read为科亚。这会给你不能被吊销的100%写保护。

  1. Only enable Read for KeyA. This will give you a 100% write protection that can't be revoked.

使能读的科亚和读/写的KEYB。还可以存储一个密钥KEYB。这将允许你使用你的秘密KEYB取消保护卡进行身份验证写保护的部门。

Enable Read for KeyA and Read/Write for KeyB. Also store a secret key in KeyB. This will allow you to authenticate a write protected sector using your secret KeyB to unprotect the card.

背景:Android将只使用验证上面显示的科亚值NDEF格式化的标签。该NDEF检测code从不试图KEYB自己,所以你可以使用KEYB你自己的目的。

Background: Android will only authenticate a Ndef formatted tag using the KeyA values shown above. The Ndef detection code never tries KeyB on its own, therefore you can use KeyB for your own purposes.

这篇关于我怎样才能保护MIFARE经典标签包含NDEF消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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