ZeroPass / dmrtd

Dart library for reading Biometric Passport
Other
67 stars 34 forks source link

Security status not satisfied #19

Closed hamidullo7 closed 11 months ago

hamidullo7 commented 11 months ago

Here is my code to read passport data using NFC:

final nfc = NfcProvider(); try { await nfc.connect(iosAlertMessage: "Hold your iPhone near Passport"); final passport = Passport(nfc);

  nfc.setIosAlertMessage("Reading EF.CardAccess...");
  final cardAccess = await passport.readEfCardAccess();

  nfc.setIosAlertMessage("Initiating session...");
  final bacKeySeed = DBAKeys(
      "AB6613787",
      DateTime(1998, DateTime.august, 17),
      DateTime(2027, DateTime.april, 21));
  await passport.startSession(bacKeySeed);

  nfc.setIosAlertMessage("Reading EF.COM...");
  final efcom = await passport.readEfCOM();

  nfc.setIosAlertMessage("Reading Data Groups...");
  EfDG1? dg1;
  if (efcom.dgTags.contains(EfDG1.TAG)) {
    dg1 = await passport.readEfDG1();
  }
  EfDG2 dg2;
  if (efcom.dgTags.contains(EfDG2.TAG)) {
    dg2 = await passport.readEfDG2();
  }
  // You can read other data groups similarly

  nfc.setIosAlertMessage("Reading EF.SOD...");
  final sod = await passport.readEfSOD();

  // You can print or display the data groups as you wish
  print(dg1?.mrz);
  // print(dg2.);
} catch (e) {
  print("as87das: $e");
  // Handle errors
} finally {
  await nfc.disconnect();
}

This line: final cardAccess = await passport.readEfCardAccess(); Gives this error in catch: Security status not satisfied

hamidullo7 commented 11 months ago

It is Uzbekistan passport which has BAC protocol

smlu commented 11 months ago

Does passport supports PACE? Have you tried commenting out the line that line?

hamidullo7 commented 11 months ago

Nope, passport doesn't support PACE, only BAC. Which line do you mean. This error occurs in this line: final cardAccess = await passport.readEfCardAccess();

Do you mean this line?

smlu commented 11 months ago

Yes, line final cardAccess = await passport.readEfCardAccess(); should be commented out. Note, that file EF.CardAccess is only available when PACE protocol is supported by the passport.

hamidullo7 commented 11 months ago

Woow, fantastic! It worked, thanks man!