MIFARE超轻3C认证 [英] Mifare Ultralight C authentication

查看:251
本文介绍了MIFARE超轻3C认证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我与NFC标签(超轻的Mifare C)工作,但我有一个身份验证问题。

如果我理解正确,第42页上应约受限页面的信息。有值04d83460所以4+应该需要身份验证的页面?

在第43页值4a402b80。为什么有这样的价值,这是什么意思?

我可以写和读第4-40页,但如果我尝试写页41+什么也不会发生。

编辑:

  MifareUltralight MIFARE =​​ MifareUltralight.get(标签);
        如果(MIFARE =​​= NULL){
            Log.e(LOGMIFARE空);
        }其他{
            Log.e(LOG,MIFARE非空);
            开关(mifare.getType()){
            案例MifareUltralight.TYPE_ULTRALIGHT:
                Log.e(LOG,超轻);
                打破;
            案例MifareUltralight.TYPE_ULTRALIGHT_C:
                Log.e(LOG,超轻C);
                打破;
            案例MifareUltralight.TYPE_UNKNOWN:
                Log.e(日志式未知);
                打破;
            }
        }
        尝试{
            mifare.connect();
            mifare.writePage(39岁,新的byte [] {0×10,0×02,0×02,0×02});            Log.e(LOG,读);            字节[] = RESP mifare.readPages(40);            对于(BYTE B:RESP){
                Log.e(LOG,RESP:+ B);
            }            mifare.close();
        }赶上(IOException异常E1){
            e1.printStackTrace();
        }


解决方案

标签似乎并没有成为一个MIFARE超轻Ç标签。相反,它似乎这是用42页的标签(这可能是,比如一个NTAG203)。

本的第一个迹象是,你从第42页读出的值: 04d83460 。这看起来像UID包括BCC0的开始。 0×04 看起来像恩智浦的制造商ID。此外,值 0x60的将是均为0x88 (级联标签)XOR 0×04的有效BCC0 XOR 0xD8 XOR 0x34 。因此,这可能是0页的一个有效值。

它的第二个迹象是你怎么看这些页面的方式:

 字节[] = RESP mifare.readPages(40);

通过这条线,你读40页开始四页如果内存面积小于44页,这个命令会翻转到存储区的开始。因此,如果存储区中,有42页,该命令将返回40,41,0页和1因此,你际preT为42页和43实际上是0和1页

有关这个问题的唯一奇怪的是,你的第2页包含值 6f480000 。如果第1页包含 4a402b80 (其余UID),​​那么第2页(BCC1)应 0x4A 字节XOR 0X40 XOR 0x2B访问 XOR 0x80的 = 0xA1 0x6F

I am working with NFC tags (Mifare Ultralight C) but I have problems with authentication.

If I understand correctly on page 42 should be information about restricted pages. There is value 04d83460 so pages 4+ should require authentication?

On page 43 value is 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.

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. Instead it seems that this is a tag with 42 pages (this could be, for instance an NTAG203).

The first indication for this is the value that you read from page 42: 04d83460. This looks like the start of the UID including BCC0. 0x04 looks like the manufacturer ID of NXP. Moreover, the value 0x60 would be a valid BCC0 for 0x88 (cascade tag) XOR 0x04 XOR 0xD8 XOR 0x34. Therefore, this could be a valid value of page 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. 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.

The only strange thing about this is that your page 2 contains the value 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.

这篇关于MIFARE超轻3C认证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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