getSignatureBySigningPassword static method

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

Implementation

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

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

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

  // SELECT FILE CERT
  var selectFileCertResult = await FlutterNfcMynumber.transceive(
      Uint8List.fromList(MynumberCommand.commandSelectFileKeySync));
  commandResultCheck(selectFileCertResult);

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