generalAuthenticatePACEstep1 method

Future<Uint8List> generalAuthenticatePACEstep1({
  1. required Uint8List data,
  2. int ne = 256,
  3. int cla = ISO7816_CLA.COMMAND_CHAINING,
})

Sends GENERAL AUTHENTICATE - step 1 command to ICC. ICC should return dynamic authentication data (with encrypted nonce in it). Can throw ICCError or ComProviderError.

Implementation

Future<Uint8List> generalAuthenticatePACEstep1(
    {required Uint8List data,
    int ne = 256,
    int cla = ISO7816_CLA.COMMAND_CHAINING}) async {
  //4.4.4.2 GENERAL AUTHENTICATE
  _log.sdVerbose("Sending GENERAL AUTHENTICATE - step 1 command to ICC"
      " data='${data.hex()}'"
      " ne=$ne"
      " cla=${cla.hex()}");
  final rapdu = await _transceive(CommandAPDU(
      cla: cla,
      ins: ISO7816_INS.GENERAL_AUTHENTICATE,
      p1: 0x00,
      p2: 0x00,
      data: data,
      ne: ne));
  if (rapdu.status != StatusWord.success) {
    throw ICCError("General authentication template (step 1) failed",
        rapdu.status, rapdu.data);
  }
  return rapdu.data!;
}