如何解码NFC身份证数据返回?

问题描述 投票:0回答:1

我要建立一个功能,可以扫描越南身份证的NFC以获取信息与flutter

扫描身份证后我得到了

1: ISoDep: {identifier: [8, 62, 241, 253], hiLayerResponse: null, historicalBytes: [77, 75, 106, 67, 79, 83, 45, 51, 55], isExtendedLengthApduSupported: true, maxTransceiveLength: 1024, timeout: 618}

2 NFCA:{identifier: [8, 62, 241, 253], atqa: [4, 0], maxTransceiveLength: 253, sak: 32, timeout: 618}

有没有办法将这些物体解码成身份证中的人的信息? 如果您知道任何解决方案,请告诉我。

我被这个问题困扰了两天,并尝试了我找到的所有解决方案,但仍然没有得到任何有效的解决方案

flutter nfc decode id-card
1个回答
0
投票

我做了类似的事情,有点意大利面条式的 if else 代码,但必须在 iOS 和 Android 之间进行检查。这是我获取标识符的方法:

 if (Platform.isIOS) {
            uid = tag.data["mifare"]["identifier"];
          } else {
            if (tag.data["ndef"] != null) {
              uid = tag.data["ndef"]["identifier"];
            } else {
              uid = tag.data["ndefformatable"]["identifier"];
            }
          }

标识符需要进行编码。为此,我使用了 Hex 包:

HEX.encode(uid).toUpperCase(),

我使用的包是这样的:https://pub.dev/packages/hex

© www.soinside.com 2019 - 2024. All rights reserved.