Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't Read VietNam IDCard #28

Open
ngocminh1805 opened this issue May 29, 2024 · 7 comments
Open

Can't Read VietNam IDCard #28

ngocminh1805 opened this issue May 29, 2024 · 7 comments

Comments

@ngocminh1805
Copy link

I try use this app to read VietNam IDCard but it notworking
Screenshot 2024-05-29 at 15 04 22

@smlu
Copy link
Member

smlu commented May 29, 2024

Fyi library only supports biometric passport standard ICAO 9303 aka MRTD. Your ID card has to support this standar in order to read it with this library.

@ngocminh1805
Copy link
Author

Fyi library only supports biometric passport standard ICAO 9303 aka MRTD. Your ID card has to support this standar in order to read it with this library.

VietNam IDcard have ICAO 9303 but this app can't not read it

@smlu
Copy link
Member

smlu commented May 30, 2024

From provided screenshot I can only guess that your card doesn't support selecting master file.
What you can try is comment out these 2 lines:

dmrtd/lib/src/passport.dart

Lines 409 to 410 in a976610

await _exec(() =>
_api.selectMasterFile()

@ngocminh1805
Copy link
Author

From provided screenshot I can only guess that your card doesn't support selecting master file. What you can try is comment out these 2 lines:

dmrtd/lib/src/passport.dart

Lines 409 to 410 in a976610

await _exec(() =>
_api.selectMasterFile()

I try that but it still not working. VietNam IdCard have ISO/IEC 7816 and ICAO 9303

@smlu
Copy link
Member

smlu commented May 30, 2024

Might be related to this: AndyQ/NFCPassportReader#219
If you're trying to read ID with iPhone iOS >= 16 it might be related to this issue: AndyQ/NFCPassportReader#164 (comment)

@ngocminh1805
Copy link
Author

ngocminh1805 commented May 31, 2024

Might be related to this: AndyQ/NFCPassportReader#219 If you're trying to read ID with iPhone iOS >= 16 it might be related to this issue: AndyQ/NFCPassportReader#164 (comment)

i do it on android. i think access card apdu command is different. i try send 00a4020c02011c and it response 9000, but your app send 00a40000 response 6a86.

@smlu
Copy link
Member

smlu commented May 31, 2024

... but your app send 00a40000 response 6a86.

Yes, this should be one of the valid SELECT FILE commands for selecting the master file. From your log, you can see there are other master file selection commands being sent prior to the final error. This happens here:

await icc.selectFile(cla: ISO7816_CLA.NO_SM, p1: 0, p2: 0)
.onError<ICCError>((error, stackTrace) async {
_log.warning("Couldn't select MF by P1: 0, P2: 0 sw=${error.sw}, re-trying to select MF with FileID=3F00");
return await icc.selectFile(cla: ISO7816_CLA.NO_SM, p1: 0, p2: 0, data: Uint8List.fromList([0x3F, 0x00]))
.onError<ICCError>((error, stackTrace) async {
_log.warning("Couldn't select MF by P1=0, P2=0, FileID=3F00 sw=${error.sw}, re-trying to select MF with P2=0x0C and FileID=3F00");
return await icc.selectFileById(p2: _defaultSelectP2, fileId: Uint8List.fromList([0x3F, 0x00]))
.onError<ICCError>((error, stackTrace) async {
_log.warning("Couldn't select MF by P1=0, P2=0x0C, FileID=3F00 sw=${error.sw}, re-trying to select MF with P2=0x0C");
return await icc.selectFile(cla: ISO7816_CLA.NO_SM, p1: 0, p2: _defaultSelectP2);
});
});
});
}

It looks like your card either doesn't support any of these commands, or if the master file is already selected (android), the card sends the wrong status word (SW) for the file being already selected.

... i try send 00a4020c02011c and it response 9000 ...

You are trying to select EF.CardAcces here, right?
What happens if you send redFileBySFI instead?

await _exec(() => _api.readFileBySFI(EfCardAccess.SFI))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants