How to decode the data return of NFC ID card?

369 Views Asked by At

I'm going to build a funtion that can scan NFC of VietNam ID-card to get the information with flutter

After scan the ID-card i got

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}

Is there any way to decode these object into the information of people in the ID card ? If you know any solution please let me know.

I was stuck with this for 2 days and tried all the solutions I found but still didn't get any working solution

2

There are 2 best solutions below

1
On

I did something similar, kinda spaghetti if else code, but had to check between iOS and Android. Here is how i get the identifier:

 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"];
            }
          }

The identifier needs to be encoded. For this I used the Hex package:

HEX.encode(uid).toUpperCase(),

The package i used is this: https://pub.dev/packages/hex

Edit:

As Andrew and Alex mentioned the information on the card shouldn't be raw information about the person itself. You will need some other service to get the correct data. I found this document (Building an Application that reads Secure Information Stored on the Chip of the Citizen Identity Card in Vietnam) here, which might help you with this topic ... looks like the author built an application to read the raw information.

https://www.etasr.com/index.php/ETASR/article/view/5531

0
On

There is no way to decode this information to get the information of people in the ID card because you have just read some technical details about the Card.

You need to send the correct additional commands as APDU's to read more information from the card to get the details you want. I'm not aware of where these commands are documented for a VietNam ID-card.