简体   繁体   English

Mifare Ultralight C认证

[英]Mifare Ultralight C authentication

I am working with NFC tags (Mifare Ultralight C) but I have problems with authentication. 我正在使用NFC标签(Mifare Ultralight C),但是认证有问题。

If I understand correctly on page 42 should be information about restricted pages. 如果我理解正确,第42页上的内容应该是有关限制页面的信息。 There is value 04d83460 so pages 4+ should require authentication? 有值04d83460,因此第4+页应该要求身份验证?

On page 43 value is 4a402b80. 在第43页上,值为4a402b80。 Why there is such a value and what that means? 为什么会有这样的价值,这意味着什么?

I can write and read to pages 4-40 but if I try to write pages 41+ nothing happens. 我可以写和读第4-40页,但是如果我尝试写第41+页,则什么也没有发生。

EDIT: 编辑:

MifareUltralight mifare = MifareUltralight.get(tag);
        if(mifare == null){
            Log.e(LOG, "mifare null");
        } else {
            Log.e(LOG, "mifare not null");
            switch(mifare.getType()){
            case MifareUltralight.TYPE_ULTRALIGHT:
                Log.e(LOG, "ultralight");
                break;
            case MifareUltralight.TYPE_ULTRALIGHT_C:
                Log.e(LOG, "ultralight c");
                break;
            case MifareUltralight.TYPE_UNKNOWN:
                Log.e(LOG, "type unknown");
                break;
            }
        }


        try {
            mifare.connect();
            mifare.writePage(39, new byte[]{0x10, 0x02, 0x02, 0x02});

            Log.e(LOG, "read");

            byte[] resp = mifare.readPages(40);

            for(byte b : resp){
                Log.e(LOG, "resp: " + b);
            }



            mifare.close();
        } catch (IOException e1) {
            e1.printStackTrace();
        }

The tag does not seem to be a MIFARE Ultralight C tag. 该标签似乎不是MIFARE Ultralight C标签。 Instead it seems that this is a tag with 42 pages (this could be, for instance an NTAG203). 相反,这似乎是一个具有42页的标签(例如NTAG203)。

The first indication for this is the value that you read from page 42: 04d83460 . 对此的第一个指示是从第42页04d83460读取的值。 This looks like the start of the UID including BCC0. 这看起来像包括BCC0的UID的开头。 0x04 looks like the manufacturer ID of NXP. 0x04看起来像NXP的制造商ID。 Moreover, the value 0x60 would be a valid BCC0 for 0x88 (cascade tag) XOR 0x04 XOR 0xD8 XOR 0x34 . 此外,值0x60将是0x88 (级联标记)XOR 0x04 XOR 0xD8 XOR 0x34的有效BCC0。 Therefore, this could be a valid value of page 0. 因此,这可能是页面0的有效值。

The second indication for this is the way how you read those pages: 第二个指示是如何阅读这些页面:

byte[] resp = mifare.readPages(40);

With this line you read four pages starting from page 40. If the memory area is smaller than 44 pages, this command will roll over to the start of the memory area. 在此行中,您从第40页开始读取四页。如果存储区小于44页,此命令将翻转到存储区的开头。 Hence, if the memory area consists of 42 pages, this command will return pages 40, 41, 0, and 1. Consequently, what you interpret as pages 42 and 43 are actually pages 0 and 1. 因此,如果存储区由42页组成,则此命令将返回第40、41、0和1页。因此,您解释为第42和43页的实际上是第0和1页。

The only strange thing about this is that your page 2 contains the value 6f480000 . 唯一奇怪的是,您的页面2包含值6f480000 If page 1 contained 4a402b80 (the remaining UID), then the first byte of page 2 (BCC1) should be 0x4A XOR 0x40 XOR 0x2B XOR 0x80 = 0xA1 and not 0x6F . 如果第1页包含4a402b80 (剩余的UID),则第2页的第一个字节(BCC1)应为0x4A XOR 0x40 XOR 0x2B XOR 0x80 = 0xA1不是 0x6F

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM