getSignatureByAuthPassword static method

Future<List<int>> getSignatureByAuthPassword(
  1. String password,
  2. Uint8List digestValue
)

Implementation

static Future<List<int>> getSignatureByAuthPassword(
    String password, Uint8List digestValue) async {
  // SELECT FILE 公的個人認証AP
  var selectFile = await FlutterNfcMynumber.transceive(
      Uint8List.fromList(MynumberCommand.commandSelectFile));
  commandResultCheck(selectFile);

  // SELECT FILE 認証用PIN
  var selectFileAuthPinResult = await FlutterNfcMynumber.transceive(
      Uint8List.fromList(MynumberCommand.commandSelectFileAuthPin));
  commandResultCheck(selectFileAuthPinResult);

  // VERIFY 認証用PIN
  var verifyUserCertificationResult = await FlutterNfcMynumber.transceive(
      Uint8List.fromList(commandSignaturePin(password.codeUnits)));
  commandResultCheck(verifyUserCertificationResult,
      MynumberCommandError.WRONG_USER_AUTH_PASSWORD);

  // SELECT FILE 認証用鍵
  var selectFileAuthKeyResult = await FlutterNfcMynumber.transceive(
      Uint8List.fromList(MynumberCommand.commandSelectFileAuthKey));
  commandResultCheck(selectFileAuthKeyResult);

  // COMPUTE DIGITAL SIGNATURE
  var commandSignatureDataResult = await FlutterNfcMynumber.transceive(
      Uint8List.fromList(commandSignatureData(digestValue)));
  commandResultCheck(commandSignatureDataResult);
  return commandSignatureDataResult
      .getRange(0, commandSignatureDataResult.length - 2)
      .toList();
}